Underp
This commit is contained in:
parent
e1ea5a28c3
commit
45bae8f96e
2 changed files with 34 additions and 17 deletions
|
@ -1,21 +1,39 @@
|
||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
set dfp (realpath (dirname (status -f))/../..)
|
has_command fzf || begin
|
||||||
function files
|
echo "fzf not installed"
|
||||||
cat $argv[1] | while read -l l
|
exit 1
|
||||||
test -d $l && echo $l
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
files $dfp/common/envs | \
|
|
||||||
fzf --multi --prompt "Select applicable environments (multi-select w/ TAB): " \
|
|
||||||
--preview-window="up:50%:noborder" \
|
|
||||||
--preview="ls -la --color=always {}" | \
|
|
||||||
string trim | \
|
|
||||||
read -a -d \n -z lines
|
|
||||||
mkdir -p $ENV_PATH
|
mkdir -p $ENV_PATH
|
||||||
for l in $lines
|
|
||||||
test $l = "" && continue
|
function filter_existing_directory
|
||||||
set ll (string replace -a / - $l)
|
while read -l l
|
||||||
echo "Linking $ENV_PATH/$ll to $dfp/$l"
|
test -d $DOTFILES_PATH/$l && echo $l
|
||||||
ln -s $dfp/$l $ENV_PATH/$ll &>/dev/null
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function reject_empty_lines
|
||||||
|
while read -l l
|
||||||
|
test $l = "" || echo $l
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function link
|
||||||
|
while read -l l
|
||||||
|
set safe_fn (string replace -a / - $l)
|
||||||
|
echo "Linking $ENV_PATH/$safe_fn to $DOTFILES_PATH/$l"
|
||||||
|
rm -f $ENV_PATH/$safe_fn
|
||||||
|
ln -s $DOTFILES_PATH/$l $ENV_PATH/$safe_fn
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
cat $DOTFILES_PATH/common/envs |
|
||||||
|
filter_existing_directory |
|
||||||
|
fzf --multi \
|
||||||
|
--prompt "Select applicable environments (multi-select w/ TAB): " \
|
||||||
|
--preview-window="up:50%:noborder" \
|
||||||
|
--preview="ls -la --color=always $DOTFILES_PATH/{}" |
|
||||||
|
string trim |
|
||||||
|
reject_empty_lines |
|
||||||
|
link
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/home/daniel/.home/.config/lytedev-dotfiles/host/desktop
|
|
Reference in a new issue