stowhome: add all keyword to match all packages

This commit is contained in:
2025-08-16 18:20:31 +02:00
parent f414fef84b
commit 9c041754b7
2 changed files with 24 additions and 5 deletions

View File

@@ -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