Call it 'completion'. like all the cool kids

main
Micke Nordin 2 years ago
parent 69ed07a9e1
commit ee215d2ebb
Signed by: micke
GPG Key ID: 0DA0A7A5708FE257

@ -20,11 +20,11 @@ A prebuilt deb-package is also available from the release page: https://code.smo
## Shell completion ## Shell completion
For bash: add this to .bashrc For bash: add this to .bashrc
``` ```
source <(knotctl complete) source <(knotctl completion)
``` ```
For fish, run: For fish, run:
``` ```
knotctl complete --shell fish > ~/.config/fish/completions/knotctl.fish knotctl completion --shell fish > ~/.config/fish/completions/knotctl.fish
``` ```
For tcsh: add this to .cshrc For tcsh: add this to .cshrc
``` ```
@ -34,15 +34,15 @@ For zsh: add this to .zshrc
``` ```
autoload -U bashcompinit autoload -U bashcompinit
bashcompinit bashcompinit
source <(knotctl complete) source <(knotctl completion)
``` ```
## Usage ## Usage
``` ```
usage: knotctl [-h] [--json | --no-json] usage: knotctl [-h] [--json | --no-json]
{add,complete,config,delete,list,update} ... {add,completion,config,delete,list,update} ...
positional arguments: positional arguments:
{add,complete,config,delete,list,update} {add,completion,config,delete,list,update}
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
@ -60,9 +60,9 @@ options:
-t TTL, --ttl TTL -t TTL, --ttl TTL
-z ZONE, --zone ZONE -z ZONE, --zone ZONE
``` ```
### COMPLETE ### COMPLETION
``` ```
usage: knotctl complete [-h] [-s SHELL] usage: knotctl completion [-h] [-s SHELL]
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit

@ -177,7 +177,7 @@ def main() -> int:
addcmd.add_argument("-t", "--ttl", required=True) addcmd.add_argument("-t", "--ttl", required=True)
addcmd.add_argument("-z", "--zone", required=True) addcmd.add_argument("-z", "--zone", required=True)
completecmd = subparsers.add_parser("complete") completecmd = subparsers.add_parser("completion")
completecmd.add_argument("-s", "--shell") completecmd.add_argument("-s", "--shell")
configcmd = subparsers.add_parser("config") configcmd = subparsers.add_parser("config")
@ -206,7 +206,7 @@ def main() -> int:
argcomplete.autocomplete(parser) argcomplete.autocomplete(parser)
args = parser.parse_args() args = parser.parse_args()
if args.command == "complete": if args.command == "completion":
run_complete(args.shell) run_complete(args.shell)
return 0 return 0

Loading…
Cancel
Save