-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add elvish support, only load interactive.* if login and interactive,…
… as intended /close #179
- Loading branch information
Showing
21 changed files
with
269 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
# https://elv.sh/get/ | ||
|
||
function setup_util_elvish() ( | ||
source "$DOROTHY/sources/bash.bash" | ||
|
||
# improve performance | ||
if is-needle --quiet "$@" && ! is-needle --upgrade "$@" && ! is-needle --uninstall "$@" && command-exists elvish; then | ||
return 0 | ||
fi | ||
|
||
# setup | ||
local arch options=( | ||
--cli='elvish' | ||
"$@" | ||
AUR='elvish' | ||
DEB='elvish' | ||
BREW='elvish' | ||
PORT='elvish' | ||
SCOOP='elvish' | ||
PKG='elvish' | ||
PKGIN='elvish' | ||
PKGADD='elvish' | ||
NIX='elvish' | ||
) | ||
setup-util "${options[@]}" | ||
) | ||
|
||
# fire if invoked standalone | ||
if test "$0" = "${BASH_SOURCE[0]}"; then | ||
setup_util_elvish "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env elvish | ||
use runtime | ||
|
||
# this should be consistent with: | ||
# $DOROTHY/init.* | ||
# $DOROTHY/commands/dorothy | ||
if (has-env 'DOROTHY') { | ||
set-env 'DOROTHY' $E:HOME'/.local/share/dorothy' | ||
} | ||
|
||
# https://elv.sh/ref/command.html#rc-file | ||
# https://elv.sh/ref/runtime.html | ||
# https://github.com/elves/elvish/issues/1726 | ||
if (not-eq $runtime:effective-rc-path $nil) { | ||
eval (cat $E:DOROTHY'/sources/login.elv' | slurp) | ||
eval (cat $E:DOROTHY'/sources/interactive.elv' | slurp) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env elvish | ||
|
||
# @todo: couldn't get this going | ||
|
||
# for scripts and sources to load a configuration file | ||
# load_dorothy_config ...<filename> | ||
fn load_dorothy_config {|@filenames| | ||
var dorothy_config_loaded = $false | ||
|
||
# for each filename, load a single config file | ||
for filename filenames { | ||
if ?(test -f $E:DOROTHY'/user/config.local/'$filename) { | ||
# load user/config.local/* | ||
eval (cat $E:DOROTHY'/user/config.local/'$filename | slurp) | ||
set dorothy_config_loaded = $true | ||
} elif ?(test -f $E:DOROTHY'/user/config/'$filename) { | ||
# otherwise load user/config/* | ||
eval (cat $E:DOROTHY'/user/config/'$filename | slurp) | ||
set dorothy_config_loaded = $true | ||
} elif ?(test -f $E:DOROTHY'/config/'$filename) { | ||
# otherwise load default configuration | ||
eval (cat $E:DOROTHY'/config/'$filename | slurp) | ||
set dorothy_config_loaded = $true | ||
} | ||
# otherwise try next filename | ||
} | ||
|
||
# if nothing was loaded, then fail | ||
if (eq dorothy_config_loaded $false) { | ||
echo-style --error="Missing the configuration file: $argv" >/dev/stderr | ||
return 2 # No such file or directory | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
#!/usr/bin/env xonsh | ||
|
||
# @todo: couldn't get this going | ||
|
||
from os import path | ||
|
||
# for scripts and sources to load a configuration file | ||
# load_dorothy_config ...<filename> | ||
def load_dorothy_config(*args): | ||
dorothy_config_loaded = 'no' | ||
dorothy_config_loaded = False | ||
|
||
# for each filename, load a single config file | ||
for filename in args: | ||
if path.exists($DOROTHY + '/user/config.local/' + filename): | ||
# load user/config.local/* | ||
execx(compilex(open($DOROTHY + '/user/config.local/' + filename).read())) | ||
dorothy_config_loaded = 'yes' | ||
dorothy_config_loaded = True | ||
elif path.exists($DOROTHY + '/user/config/' + filename): | ||
# otherwise load user/config/* | ||
execx(compilex(open($DOROTHY + '/user/config/' + filename).read())) | ||
dorothy_config_loaded = 'yes' | ||
dorothy_config_loaded = True | ||
elif path.exists($DOROTHY + '/config/' + filename): | ||
# otherwise load default configuration | ||
execx(compilex(open($DOROTHY + '/config/' + filename).read())) | ||
dorothy_config_loaded = 'yes' | ||
dorothy_config_loaded = True | ||
# otherwise try next filename | ||
|
||
# if nothing was loaded, then fail | ||
if dorothy_config_loaded == 'no': | ||
if dorothy_config_loaded == False: | ||
echo-style --error=@('Missing the configuration file: ' + args.join(' ')) >/dev/stderr | ||
return 2 # No such file or directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env elvish | ||
|
||
# set the environment variables | ||
eval ($E:DOROTHY'/commands/setup-environment-commands' elvish | slurp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env elvish | ||
|
||
# use test -f, instead of os builtin, as test -f actually handles /user symlink | ||
|
||
# Load the configuration for interactive shells | ||
if ?(test -f $E:DOROTHY'/user/config.local/interactive.elv') { | ||
eval (cat $E:DOROTHY'/user/config.local/interactive.elv' | slurp) | ||
} elif ?(test -f $E:DOROTHY'/user/config/interactive.elv') { | ||
eval (cat $E:DOROTHY'/user/config/interactive.elv' | slurp) | ||
} elif ?(test -f $E:DOROTHY'/config/interactive.elv') { | ||
eval (cat $E:DOROTHY'/config/interactive.elv' | slurp) | ||
} | ||
|
||
# Continue with the shell extras | ||
# use ./history.elv | ||
eval (cat $E:DOROTHY'/sources/theme.elv' | slurp) | ||
# use ./ssh.elv | ||
# use ./autocomplete.elv |
Oops, something went wrong.