#clap #structopt #cli #flags


Collection of reusable flags for StructOpt

2 unstable releases

0.2.0 Oct 15, 2018
0.1.0 Oct 7, 2018

#100 in Command-line interface

Download history 9/week @ 2018-10-11 41/week @ 2018-10-18 3/week @ 2018-10-25 7/week @ 2018-11-01 69/week @ 2018-11-08 22/week @ 2018-11-15 7/week @ 2018-11-22

18 downloads per month


333 lines


Build Status Docs dependency status

A set of reusable flags and option for your CLIs using StructOpt

Getting started

Add the crate to your project, adding this in Cargo.toml:

structopt-flags = "0.2"

In your code, you can use one or more flags provided by this crate. For instance:

extern crate failure;
extern crate structopt;
extern crate structopt_flags;

use failure::Error;
use structopt::StructOpt;
use structopt_flags::LogLevel; // traits for flags that can provide a log level

#[derive(Debug, StructOpt)]
#[structopt(name = "verbose", about = "An example using verbose flag")]
struct Opt {
    verbose: structopt_flags::Verbose,

fn main() -> Result<(), Error> {
    let opt = Opt::from_args();
	let _log_level = opt.verbose.get_level_filter();
	// set the log level of your preferred log crate


Licensed under:


~41K SLoC