Fix completions and config
This commit is contained in:
parent
149dc17019
commit
b866a713a2
2 changed files with 12 additions and 10 deletions
|
@ -39,7 +39,7 @@ options:
|
|||
|
||||
For bash: add this to .bashrc
|
||||
```
|
||||
eval "$(knotctl complete)"
|
||||
source <(knotctl complete)
|
||||
```
|
||||
For fish, run:
|
||||
```
|
||||
|
@ -47,11 +47,13 @@ knotctl complete --shell fish > ~/.config/fish/completions/knotctl.fish
|
|||
```
|
||||
For tcsh: add this to .cshrc
|
||||
```
|
||||
eval "$(knotctl complete --shell tcsh)"
|
||||
complete "knotctl" 'p@*@`python-argcomplete-tcsh "knotctl"`@' ;
|
||||
```
|
||||
For zsh: add this to .zshrc
|
||||
```
|
||||
eval "$(autoload -U bashcompinit; bashcompinit; scripts/knotctl complete)"
|
||||
autoload -U bashcompinit
|
||||
bashcompinit
|
||||
source <(knotctl complete)
|
||||
```
|
||||
### CONFIG
|
||||
```
|
||||
|
|
|
@ -70,8 +70,7 @@ def run_complete(shell: Union[None, str]):
|
|||
elif shell == "fish":
|
||||
os.system("register-python-argcomplete --shell fish knotctl")
|
||||
elif shell == "tcsh":
|
||||
os.system("register-python-argcomplete --shell tcsh knotctl",
|
||||
shell=True)
|
||||
os.system("register-python-argcomplete --shell tcsh knotctl")
|
||||
|
||||
|
||||
def run_config(
|
||||
|
@ -214,10 +213,13 @@ def main() -> int:
|
|||
if not isdir(config_basepath):
|
||||
mkdir(config_basepath)
|
||||
|
||||
if args.command == "config":
|
||||
run_config(args.baseurl, args.username, args.password)
|
||||
return 0
|
||||
|
||||
if not isfile(config_filename):
|
||||
if args.command != "config":
|
||||
print("You need to configure knotctl before proceeding")
|
||||
run_config(config_filename)
|
||||
print("You need to configure knotctl before proceeding")
|
||||
run_config(config_filename)
|
||||
|
||||
config = get_config(config_filename)
|
||||
baseurl = config["baseurl"]
|
||||
|
@ -241,8 +243,6 @@ def main() -> int:
|
|||
url = setup_url(baseurl, args.data, args.name, args.rtype, ttl, args.zone)
|
||||
if args.command == "add":
|
||||
run_add(url, args.json, headers)
|
||||
elif args.command == "config":
|
||||
run_config(args.baseurl, args.username, args.password)
|
||||
elif args.command == "delete":
|
||||
run_delete(url, args.json, headers)
|
||||
elif args.command == "list":
|
||||
|
|
Loading…
Add table
Reference in a new issue