[![Crates.io](https://img.shields.io/crates/v/easy-cli.svg)](https://crates.io/crates/easy-cli) # easy-cli A tool for building personal and team CLI tools. easy-cli takes a CLI-Tool name option and a path to a directory of scripts as arguments. It assumes each script ist to be a CLI command, and builds an appropriate CLI parser. It could be used as an alias, but (in my experience, in zsh) this does not work with completion. You can define a function for your cli, for instance: ``` mycli() { /easy-cli --name mycli /example -- $@ } ``` and then calling ``` mycli ``` produces output: ``` error: 'mycli' requires a subcommand but one was not provided [subcommands: hello, list, help] Usage: mycli For more information try '--help' ``` Then calling ``` mycli hello ``` will print ``` Hello, world! ``` Arguments trailing the command will be passed to the relevant script. # Argument-Parsing easy-cli looks for metadata in the scripts regarding the command and arguments. Currently, the following patterns are recognised: - ```#@description ```: Used in the command line help text to describe the command. - ```#@argument ```: Defines an argument usable as "--argname". It may or may not have values (has_args), and can have a help text (description) - ```#@anyarg```: If present, allows the command to accept any argument. Otherwise, only the defined ones will be accepted. ## Completion easy-cli offers completion for your cli in a number of shells - those supported by [clap_complete](https://crates.io/crates/clap_complete). To generate completions for your cli, run: ``` easy-cli --name --completions > ``` and proceed as required by your shell. ## Next Planned Features 1. CLI subcommands (for instance, ```cli ```), to group related commands. 1. Parsing script options from the script and adding them to the CLI, for better help. 1. Environments, so that the CLI can easily be used to apply different environments (e.g. for staging).