Skip to content

Commit

Permalink
Shell completion command (#332)
Browse files Browse the repository at this point in the history
* implemented a rough concept for generating shelll completion scripts for a number of common shells

* ran cargo fmt

* added docstring for completion command and put it in alphabetic order

* implemented bash, fish powershell and zsh shell completion suggestions

* updated help output in the README.md

* updated the catch all case for the shell match and added a docstring for the completion::run function

* removed fixed comment

* added elvish suggestion

* swapped the order of printing the script and printing the suggestion, it now prints the suggestion last

* fixed clippy lints

* removed rename reference in suggestion text

* removed suggestion output

* added documentation for shell completion scripts

* fixed copied typo

* Added extra newline in docs

Co-authored-by: Chris Pryer <[email protected]>

* added a config command and a completion sub command to that

* Deleting forgotten section from the README.md

Co-authored-by: Chris Pryer <[email protected]>

* moved comment from config struct to the actual command enum

* updated file structure

* added install and uninstall commands to automatically add shell completion script to init files

* Update src/bin/huak/commands/config/completion.rs

Co-authored-by: Chris Pryer <[email protected]>

* added new line to end of file

* removed config from ops

* removed config

* moved config code to bin

* removed (un)install commands and added flags for them on completion instead

* added a os dependency on tests

* fixed target attribute for tests

* made the shell flag only madatory when --install or --uninstall is passed, otherwise huak config completion just prints to stdout

* Finalize completion command
  • Loading branch information
MitchellBerend authored Oct 31, 2022
1 parent 45e9785 commit 71f08d5
Show file tree
Hide file tree
Showing 9 changed files with 477 additions and 19 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ path = "./src/huak/lib.rs"

[dependencies]
clap = {version = "4.0.15", features = ["cargo", "derive"]}
clap_complete = "4.0"

thiserror = "1.0.36"
fs_extra = "1.2.0"
glob = "0.3.0"
Expand Down
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,26 @@ A Python package manager written in Rust inspired by Cargo.
Usage: huak <COMMAND>

Commands:
activate Activate the project's virtual environment
add Add a dependency to the existing project
audit Check for vulnerable dependencies and license compatibility*
build Build tarball and wheel for the project
clean Remove tarball and wheel from the built project
doc Generates documenation for the project*
fix Auto-fix fixable lint conflicts
fmt Format the project's Python code
init Initialize the existing project
install Install the dependencies of an existing project
lint Lint the project's Python code
new Create a new project at <path>
publish Builds and uploads current project to a registry*
remove Remove a dependency from the project
run Run a command within the project's environment context
test Test the project's Python code
update Update dependencies added to the project*
version Display the version of the project
help Print this message or the help of the given subcommand(s)
activate Activate the project's virtual environment
add Add a dependency to the existing project
audit Check for vulnerable dependencies and license compatibility*
build Build tarball and wheel for the project
completion Generates a shell completion script for supported shells. See the help menu for more information on supported shells
clean Remove tarball and wheel from the built project
doc Generates documentation for the project*
fix Auto-fix fixable lint conflicts
fmt Format the project's Python code
init Initialize the existing project
install Install the dependencies of an existing project
lint Lint the project's Python code
new Create a new project at <path>
publish Builds and uploads current project to a registry*
remove Remove a dependency from the project
run Run a command within the project's environment context
test Test the project's Python code
update Update dependencies added to the project*
version Display the version of the project
help Print this message or the help of the given subcommand(s)
```
_"*" indicates first-pass of implementation is incomplete._

Expand Down
Loading

0 comments on commit 71f08d5

Please sign in to comment.