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

Add shell completion #348

Merged
merged 22 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN echo 'alias cov="/workspaces/ankaios/tools/generate_test_coverage_report.sh"
# add aliases for development scripts and tools
RUN echo 'alias ankaios-start="/workspaces/ankaios/tools/dev_scripts/ankaios-start"' | tee -a /home/${USERNAME}/.bashrc /home/${USERNAME}/.zshrc
RUN echo 'alias ankaios-clean="/workspaces/ankaios/tools/dev_scripts/ankaios-clean"' | tee -a /home/${USERNAME}/.bashrc /home/${USERNAME}/.zshrc
RUN echo 'alias ank="/workspaces/ankaios/target/x86_64-unknown-linux-musl/debug/ank"' | tee -a /home/${USERNAME}/.bashrc /home/${USERNAME}/.zshrc
RUN echo 'export PATH=$PATH:/workspaces/ankaios/target/x86_64-unknown-linux-musl/debug' | tee -a /home/${USERNAME}/.bashrc /home/${USERNAME}/.zshrc

# work in insecure mode in the dev container
RUN echo 'export ANKAGENT_INSECURE=true' | tee -a /home/${USERNAME}/.bashrc /home/${USERNAME}/.zshrc
Expand All @@ -40,6 +40,10 @@ RUN echo 'alias ll="ls -la"' | tee -a /home/${USERNAME}/.bashrc /home/${USERNAME
RUN echo 'alias ..="cd .."' | tee -a /home/${USERNAME}/.bashrc /home/${USERNAME}/.zshrc
RUN echo 'alias ...="cd ../.."' | tee -a /home/${USERNAME}/.bashrc /home/${USERNAME}/.zshrc

# shell completion
RUN echo 'if command -v ank &> /dev/null; then source <(COMPLETE=bash ank); fi' >> /home/${USERNAME}/.bashrc
RUN echo 'if command -v ank &> /dev/null; then source <(COMPLETE=zsh ank); fi' >> /home/${USERNAME}/.zshrc

USER ${USERNAME}

COPY .git_commit_template.txt /home/${USERNAME}/
29 changes: 29 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ank/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ serde_yaml = "0.9"
tabled = "0.12"
uuid = { version = "1.7.0", features = ["v4"] }
crossterm = "0.27.0"
clap_complete = { version = "<=4.5.24", features = ["unstable-dynamic", "unstable-command"] }

[dev-dependencies]
mockall = "0.11"
Expand Down
20 changes: 20 additions & 0 deletions ank/doc/swdesign/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,26 @@ Needs:
- impl
- utest

### Shell completion
`swdd~cli-shell-completion~1`

Status: approved

When the user starts typing an Ankaios CLI command, the zsh and bash shell shall propose completions for arguments including dynamic completions for workload names, object field masks and agents.

Rationale:
A user's productivity is increased when command completions are provided which reduces lookups for the user.

Comment:
If possible more shells shall be supported as well.

Tags:
- CliCommands

Needs:
- impl
- utest

### CliTable allows creation of different table output formats

#### CliTable provides default table output
Expand Down
Loading