stowhome: add all keyword to match all packages
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
function get_all_packages() {
|
||||
cd "$HOME/.config/dotfiles"
|
||||
find . -maxdepth 1 -type d -not -name ".git" -not -name "."
|
||||
}
|
||||
|
||||
stow_cmd="stow --dir '$HOME/.config/dotfiles' --target '$HOME' --dotfiles"
|
||||
|
||||
if [ "$*" == "" ]
|
||||
then
|
||||
echo "you must supply at least one package"
|
||||
echo
|
||||
echo "packages:"
|
||||
cd "$HOME/.config/dotfiles" && find . -maxdepth 1 -type d -not -name ".git" -not -name "." | sed -e 's|^.\/| - |'
|
||||
echo "available packages:"
|
||||
get_all_packages | sed -e 's|^.\/| - |'
|
||||
else
|
||||
stow --dir "$HOME/.config/dotfiles" --target "$HOME" --dotfiles $*
|
||||
if [ "$(echo "$*" | grep -E -e '^(.* )?all$')" != "" ]
|
||||
then
|
||||
all_packages=$(get_all_packages | sed -e 's|^.\/||' | tr '\n' ' ')
|
||||
$stow_cmd $(echo "$*" | sed -e "s/all/$all_packages/")
|
||||
else
|
||||
$stow_cmd $*
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user