cargo-cli

Create a command line interface binary with some common dependencies ((clap || docopt) and error_chain)

Installation

cargo install cargo-cli

Usage

In general, this is extension is used in the same manner as you would use cargo new --bin. Most of the command line arguments supported by cargo new are supported by cargo cli and are actually passed through to cargo new.

In addition, cargo cli supports the following options:

```text cargo-cli 0.1.0

USAGE: cargo-cli cli [FLAGS] [OPTIONS]

FLAGS: --frozen Require Cargo.lock and cache are up to date -h, --help Prints help information --locked Require Cargo.lock is up to date --no-latest Turn off the crates.io query for the latest version (use defaults). --no-readme Turn off README.md generation. -q, --quiet No output printed to stdout -v Use verbose output (-vv very verbose/build.rs output)

OPTIONS: -a, --arg_parser Specify the argument parser to use in the generated output. [default: clap] [values: clap, docopt] --color Coloring [default: auto] [values: auto, always, never] --license Specify licensing to include in the generated output. [default: both] [values: both, mit, apache, none] --name Set the resulting package name, defaults to the value of . --vcs Initialize a new repository for the given version control system or do not initialize any version control at all, overriding a global configuration. [default: git] [values: git, hg, pijul, fossil, none]

ARGS: ```

Examples

With clap

cargo cli <path>

With docopt

cargo cli -a docopt <path>

No licenses or README.md

cargo cli --license none --no-readme <path>

With some cargo new arguments

cargo cli --vcs pijul -vv -a docopt --name flambe <path>

CLI Layout

Default

text . ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── src ├── error.rs ├── main.rs └── run.rs

No Licenses or README.md

text . ├── Cargo.toml └── src ├── error.rs ├── main.rs └── run.rs