Readd short option for config

This commit is contained in:
a-kenji 2021-04-04 19:27:28 +02:00
parent ca014d7aac
commit d9a85e977d
3 changed files with 55 additions and 2 deletions

View file

@ -39,7 +39,27 @@ _zellij() {
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:zellij-command-$line[1]:" curcontext="${curcontext%:*:*}:zellij-command-$line[1]:"
case $line[1] in case $line[1] in
(config) (c)
_arguments "${_arguments_options[@]}" \
'--clean[Disables loading of configuration file at default location]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::path:_files' \
&& ret=0
;;
(c)
_arguments "${_arguments_options[@]}" \
'--clean[Disables loading of configuration file at default location]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::path:_files' \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'--clean[Disables loading of configuration file at default location]' \ '--clean[Disables loading of configuration file at default location]' \
'-h[Prints help information]' \ '-h[Prints help information]' \
@ -70,6 +90,20 @@ _zellij_commands() {
) )
_describe -t commands 'zellij commands' commands "$@" _describe -t commands 'zellij commands' commands "$@"
} }
(( $+functions[_c_commands] )) ||
_c_commands() {
local commands; commands=(
)
_describe -t commands 'c commands' commands "$@"
}
(( $+functions[_zellij__c_commands] )) ||
_zellij__c_commands() {
local commands; commands=(
)
_describe -t commands 'zellij c commands' commands "$@"
}
(( $+functions[_zellij__config_commands] )) || (( $+functions[_zellij__config_commands] )) ||
_zellij__config_commands() { _zellij__config_commands() {
local commands; commands=( local commands; commands=(

View file

@ -13,6 +13,9 @@ _zellij() {
cmd="zellij" cmd="zellij"
;; ;;
c)
cmd+="__c"
;;
config) config)
cmd+="__config" cmd+="__config"
;; ;;
@ -26,7 +29,7 @@ _zellij() {
case "${cmd}" in case "${cmd}" in
zellij) zellij)
opts=" -m -d -h -V -s -o -l --move-focus --debug --help --version --split --open-file --max-panes --layout config help" opts=" -m -d -h -V -s -o -l --move-focus --debug --help --version --split --open-file --max-panes --layout config help c c"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
@ -69,6 +72,21 @@ _zellij() {
return 0 return 0
;; ;;
zellij__c)
opts=" -h -V --clean --help --version <path> "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zellij__config) zellij__config)
opts=" -h -V --clean --help --version <path> " opts=" -h -V --clean --help --version <path> "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then

View file

@ -34,6 +34,7 @@ pub struct CliArgs {
#[derive(Debug, StructOpt)] #[derive(Debug, StructOpt)]
pub enum ConfigCli { pub enum ConfigCli {
/// Path to the configuration yaml file /// Path to the configuration yaml file
#[structopt(alias = "c")]
Config { Config {
path: Option<PathBuf>, path: Option<PathBuf>,
#[structopt(long)] #[structopt(long)]