Crates.io | clappconfig |
lib.rs | clappconfig |
version | 0.4.0 |
source | src |
created_at | 2020-04-20 11:45:22.94081 |
updated_at | 2020-05-10 20:59:05.52392 |
description | Clap-based app config boilerplate: set up logging, load config, parse args |
homepage | |
repository | https://git.ondrovo.com/packages/cli-app-base |
max_upload_size | |
id | 232164 |
size | 31,422 |
Clap
App
Config
-----------
clappconfig
This crate provides a simple CLI app boilerplate that takes care of the most repetitive init tasks:
Default::default()
)clap
Supports custom clap
arguments as well.
-> The repository is open to improvement PRs.
env_logger
by default--log
CLI flag-v
or --verbose
The crates re-exports crates used in public API: clap
, anyhow
, log
.
See the examples directory.
The example called "rotn" implements rot13 as a command-line tool.
$ cargo run --example rotn -- -h
Rot-N 0.1.0 by Ondřej Hruška <ondra@ondrovo.com>
USAGE:
rotn [FLAGS] [OPTIONS] --input <FILE>
FLAGS:
--default-config Print the default config JSON for reference (or to be piped to a file)
--dump-config Print the loaded config struct
-h, --help Prints help information
-V, --version Prints version information
-v, --verbose Increase logging verbosity (repeat to increase)
OPTIONS:
-c, --config <FILE> Sets a custom config file (JSON5)
-i, --input <FILE> Input file
--log <LEVEL> Set logging verbosity (error,warning,info,debug,trace)
-n, --shift <N> Positive or negative shift, default 13
To get rot13 of this README, run cargo run --example rotn -- -iREADME.md
.