Skip to content

Commit

Permalink
Merge pull request #348 from eclipse-ankaios/237_auto_completion
Browse files Browse the repository at this point in the history
Add shell completion
  • Loading branch information
krucod3 committed Sep 4, 2024
2 parents 0f82899 + 02ce396 commit 08d4db2
Show file tree
Hide file tree
Showing 8 changed files with 384 additions and 8 deletions.
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

0 comments on commit 08d4db2

Please sign in to comment.