From d9a85e977d4c81f6efcf73785b1e17175d3edc59 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Sun, 4 Apr 2021 19:27:28 +0200 Subject: [PATCH] Readd short option for config --- assets/completions/_zellij | 36 +++++++++++++++++++++++++++++++++- assets/completions/zellij.bash | 20 ++++++++++++++++++- src/cli.rs | 1 + 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/assets/completions/_zellij b/assets/completions/_zellij index 8b89db14..fc1cd00f 100644 --- a/assets/completions/_zellij +++ b/assets/completions/_zellij @@ -39,7 +39,27 @@ _zellij() { (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:zellij-command-$line[1]:" 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[@]}" \ '--clean[Disables loading of configuration file at default location]' \ '-h[Prints help information]' \ @@ -70,6 +90,20 @@ _zellij_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] )) || _zellij__config_commands() { local commands; commands=( diff --git a/assets/completions/zellij.bash b/assets/completions/zellij.bash index 549b1e9f..10c18d53 100644 --- a/assets/completions/zellij.bash +++ b/assets/completions/zellij.bash @@ -13,6 +13,9 @@ _zellij() { cmd="zellij" ;; + c) + cmd+="__c" + ;; config) cmd+="__config" ;; @@ -26,7 +29,7 @@ _zellij() { case "${cmd}" in 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 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -69,6 +72,21 @@ _zellij() { return 0 ;; + zellij__c) + opts=" -h -V --clean --help --version " + 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) opts=" -h -V --clean --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then diff --git a/src/cli.rs b/src/cli.rs index d4c0f78a..b1fb8f38 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -34,6 +34,7 @@ pub struct CliArgs { #[derive(Debug, StructOpt)] pub enum ConfigCli { /// Path to the configuration yaml file + #[structopt(alias = "c")] Config { path: Option, #[structopt(long)]