Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PXP-371: CLI should support autocomplete for the commands #7

Merged
merged 4 commits into from
Aug 22, 2022

Conversation

jk-gan
Copy link
Contributor

@jk-gan jk-gan commented Aug 18, 2022

Ticket: PXP-371

Changelog

New

  • wukong completions <SHELL> command to generate wukong completions for user's shell at runtime
  • add a shell script (generate-completions.sh) to generate wukong completions (it should be useful for CI/CD)

Screenshot

Screenshot 2022-08-18 at 4 53 07 PM

Screenshot 2022-08-18 at 4 53 54 PM

Screenshot 2022-08-18 at 4 57 04 PM

Screenshot 2022-08-18 at 4 56 59 PM

Screenshot 2022-08-18 at 4 57 58 PM

@jk-gan jk-gan changed the base branch from main to feat/auth August 18, 2022 08:55
@jk-gan jk-gan requested review from Fadhil and onimsha August 18, 2022 08:58
@jk-gan jk-gan self-assigned this Aug 18, 2022
@jk-gan jk-gan added the feature New feature label Aug 18, 2022
@onimsha
Copy link
Contributor

onimsha commented Aug 22, 2022

It not working properly on my end.

My current env:

❯ zsh --version
zsh 5.8 (x86_64-apple-darwin20.1.0)

Loading the completion in ZSH shell throws this error.

❯ source <(./target/debug/wukong completions zsh)
_arguments:comparguments:325: can only be called from completion function

Also running the generate-completions.sh scripts throws some error.

❯ ./generate-completions.sh
error: Found argument 'completions' which wasn't expected, or isn't valid in this context

USAGE:
    wukong [OPTIONS] <SUBCOMMAND>

For more information try --help
bash completions generated successfully at /Users/tuanco/code-workspaces/rust/src/github.com/mindvalley/wukong-cli/completions/bash/wukong.bash.
error: Found argument 'completions' which wasn't expected, or isn't valid in this context

USAGE:
    wukong [OPTIONS] <SUBCOMMAND>

For more information try --help
zsh completions generated successfully at /Users/tuanco/code-workspaces/rust/src/github.com/mindvalley/wukong-cli/completions/zsh/_wukong.
error: Found argument 'completions' which wasn't expected, or isn't valid in this context

USAGE:
    wukong [OPTIONS] <SUBCOMMAND>

For more information try --help
fish completions generated successfully at /Users/tuanco/code-workspaces/rust/src/github.com/mindvalley/wukong-cli/completions/fish/wukong.fish.

@jk-gan
Copy link
Contributor Author

jk-gan commented Aug 22, 2022

According to starship/starship#2806, we will have to replace the last line from the zsh completion generated by clap in order to let the completion source-able.

I've added the replacement in the generate-completions.sh.
Screenshot 2022-08-22 at 1 07 24 PM
Screenshot 2022-08-22 at 1 07 19 PM

@onimsha onimsha merged commit 6e089cb into feat/auth Aug 22, 2022
@onimsha onimsha deleted the feat/cli-completion branch August 22, 2022 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Development

Successfully merging this pull request may close these issues.

2 participants