stowhome: add all keyword to match all packages
This commit is contained in:
parent
f414fef84b
commit
9c041754b7
10
readme.md
10
readme.md
@ -45,13 +45,13 @@ is to prevent a repository full of hidden files.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Link the dotfiles:
|
### Link the dotfiles (stewing)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
stowhome <package> [<package> [<package> [...]]]
|
stowhome <package> [<package> [<package> [...]]]
|
||||||
```
|
```
|
||||||
|
|
||||||
Where `<package>` is a directory from this repo.
|
Where `<package>` is a directory from this repo or `all` foor all packages.
|
||||||
|
|
||||||
If the dotfiles already exist as normal files (not symlinks), it will skip this
|
If the dotfiles already exist as normal files (not symlinks), it will skip this
|
||||||
file. To overwrite the file in stow, use this command:
|
file. To overwrite the file in stow, use this command:
|
||||||
@ -63,6 +63,12 @@ stowhome --adopt <package> [<package> [<package> [...]]]
|
|||||||
To overwrite the dotfile, you can just remove or rename the file and then run
|
To overwrite the dotfile, you can just remove or rename the file and then run
|
||||||
`stowhome` again.
|
`stowhome` again.
|
||||||
|
|
||||||
|
### Unlink the dotfiles (destewing)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
stowhome -D <package> [<package> [<package> [...]]]
|
||||||
|
```
|
||||||
|
|
||||||
### Update dotfiles
|
### Update dotfiles
|
||||||
|
|
||||||
To edit an already managed by stowhome dotfile, you can just edit it. The
|
To edit an already managed by stowhome dotfile, you can just edit it. The
|
||||||
|
|||||||
@ -1,11 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/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 [ "$*" == "" ]
|
if [ "$*" == "" ]
|
||||||
then
|
then
|
||||||
echo "you must supply at least one package"
|
echo "you must supply at least one package"
|
||||||
echo
|
echo
|
||||||
echo "packages:"
|
echo "available packages:"
|
||||||
cd "$HOME/.config/dotfiles" && find . -maxdepth 1 -type d -not -name ".git" -not -name "." | sed -e 's|^.\/| - |'
|
get_all_packages | sed -e 's|^.\/| - |'
|
||||||
else
|
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
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user