Manager: Improve option handling using GNU getopt

This commit is contained in:
Riyyi
2021-08-19 02:16:06 +02:00
parent c2fe4ca3bf
commit ec85c0aff6
2 changed files with 57 additions and 60 deletions
+7 -7
View File
@@ -5,20 +5,20 @@ _dotfiles.sh() {
local -a args
args+=(
'(- *)'{-a,--add}'[add file to the dotfiles directory]:file:_files'
'(- *)'{-f,--files}'[display all files added to the dotfiles directory]'
'(- *)'{-h,--help}'[display usage message and exit]'
'(- *)'{-p,--packages}'[instal, list or store packages]:packages:((
'*'{-a,--add=}'[add file to the dotfiles directory]:file:_files'
'(-f --files)'{-f,--files}'[display all files added to the dotfiles directory]'
'(-)'{-h,--help}'[display usage message and exit]'
'(-p --packages)'{-p,--packages=}'[instal, list or store packages]:package functions:((
install\:"install all core packages of the stored list"
install-aur\:"install all AUR packages of the stored list"
list\:"display all packages installed on the system (default)"
store\:"stores a list of all installed packages"
))'
'(- *)'{-l,--pull}'[pull each added file from system to dotfiles directory]'
'(- *)'{-s,--push}'[push each added file to its location on the system]'
'(-l --pull)'{-l,--pull}'[pull each added file from system to dotfiles directory]'
'(-s --push)'{-s,--push}'[push each added file to its location on the system]'
)
_arguments $args[@] && ret=0
_arguments -s -S $args[@] && ret=0
return ret
}