diff --git a/.general.rc b/.general.rc index f215daf..f6e1e07 100644 --- a/.general.rc +++ b/.general.rc @@ -7,4 +7,57 @@ else alias myip="curl https://ipinfo.io/json 2> /dev/null" fi -alias ip='ip -c' \ No newline at end of file +alias ip='ip -c' + +function _kfg { + local -a _options _commands _programs + + _programs=( + 'all:Install everything' + 'zsh:Powerful Shell' + 'tmux:Terminal Multiplexer' + 'unp:Perl script to make file archive extraction easier' + 'bat:cat replacement with syntax highlighting and git integration' + 'lsd:ls replacement with colors, icons, tree-view and more' + 'omp:Customisable shell prompt renderer' + 'zoxide:A smarter cd command' + 'fzf:A command-line fuzzy finder' + 'fzf-tab:Replace zsh default completion selection menu with fzf' + ) + + _commands=( + 'update:Update kfg' + 'install:Install programs and configs' + 'version:Print version number' + ) + + _options=( + {-h,--help}'[Show this help]' + {-y,--yes}'[Skip confirmation questions]' + #{-a,--arch}' STRING [Set the architecture string to be used when downloading files from repositories. Most common are "amd64", "arm64", "armhf", etc]' + {-d,--debug}'[Print debug output]' + ) + + function _kfg_install { + _arguments -C '*:: :->subcmds' + if (( CURRENT == 1 ));then + _describe -t programs "kfg install programs" _programs + return + else + _arguments $_options + return + fi + } + + _arguments -C '*:: :->subcmds' + if (( CURRENT == 1 ));then + _describe -t commands "kfg command" _commands + return + fi + + case "$words[1]" in + install) _kfg_install && return 0 ;; + *) _kfg_options && return 0 ;; + esac +} +compdef _kfg kfg \ No newline at end of file