Initial commit
To implement commands `clap` is used to parse arguments.
This commit is contained in:
commit
2b96bcc562
5 changed files with 289 additions and 0 deletions
15
src/cli.rs
Normal file
15
src/cli.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use clap::{crate_authors, crate_version, AppSettings, Clap};
|
||||
|
||||
#[derive(Clap, Debug)]
|
||||
#[clap(
|
||||
version = crate_version!(),
|
||||
author = crate_authors!(", "),
|
||||
setting = AppSettings::SubcommandRequiredElseHelp,
|
||||
global_setting = AppSettings::VersionlessSubcommands,
|
||||
global_setting = AppSettings::InferSubcommands,
|
||||
)]
|
||||
pub struct Opts {
|
||||
/// Produce verbose output
|
||||
#[clap(short, long, global = true)]
|
||||
pub verbose: bool,
|
||||
}
|
9
src/main.rs
Normal file
9
src/main.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
use clap::Clap;
|
||||
|
||||
mod cli;
|
||||
|
||||
use cli::Opts;
|
||||
|
||||
fn main() {
|
||||
Opts::parse();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue