mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
parent
62297c7040
commit
4f836ee5ef
19 changed files with 7 additions and 3 deletions
|
@ -2,8 +2,8 @@ extern crate clap;
|
|||
|
||||
use clap::{App};
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
|
||||
// Apps describe the top level application
|
||||
//
|
||||
// You create an App and set various options on that App using the "builder pattern"
|
|
@ -2,8 +2,8 @@ extern crate clap;
|
|||
|
||||
use clap::{App, Arg};
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
|
||||
// Args describe a possible valid argument which may be supplied by the user at runtime. There
|
||||
// are three different types of arguments (flags, options, and positional) as well as a fourth
|
||||
// special type of argument, called SubCommands (which will be discussed separately).
|
|
@ -3,6 +3,7 @@ extern crate clap;
|
|||
|
||||
use clap::App;
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
// You can have clap pull the application version directly from your Cargo.toml starting with
|
||||
// clap v0.4.14 on crates.io (or master#a81f915 on github). Using Rust's env! macro like this:
|
|
@ -2,6 +2,7 @@ extern crate clap;
|
|||
|
||||
use clap::{App, Arg};
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
// You can get a "default value" like feature by using Option<T>'s .unwrap_or() method
|
||||
//
|
|
@ -2,6 +2,7 @@ extern crate clap;
|
|||
|
||||
use clap::{App, Arg};
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
// You can define a function (or a closure) to use as a validator to argument values. The
|
||||
// function must accept a String and return Result<(), String> where Err(String) is the message
|
|
@ -2,6 +2,7 @@ extern crate clap;
|
|||
|
||||
use clap::{App, AppSettings, SubCommand};
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
// You can use AppSettings to change the application level behavior of clap. .setting() function
|
||||
// of App struct takes AppSettings enum as argument. There is also .settings() function which
|
|
@ -1,4 +1,4 @@
|
|||
use super::{App, Arg, SubCommand, AppSettings};
|
||||
use super::{App, Arg, SubCommand};
|
||||
use std::collections::HashSet;
|
||||
use std::vec::Vec;
|
||||
|
||||
|
|
Loading…
Reference in a new issue