mirror of
https://github.com/clap-rs/clap
synced 2024-09-21 06:41:54 +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};
|
use clap::{App};
|
||||||
|
|
||||||
|
#[allow(unused_variables)]
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
||||||
// Apps describe the top level application
|
// Apps describe the top level application
|
||||||
//
|
//
|
||||||
// You create an App and set various options on that App using the "builder pattern"
|
// 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};
|
use clap::{App, Arg};
|
||||||
|
|
||||||
|
#[allow(unused_variables)]
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
||||||
// Args describe a possible valid argument which may be supplied by the user at runtime. There
|
// 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
|
// 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).
|
// special type of argument, called SubCommands (which will be discussed separately).
|
|
@ -3,6 +3,7 @@ extern crate clap;
|
||||||
|
|
||||||
use clap::App;
|
use clap::App;
|
||||||
|
|
||||||
|
#[allow(unused_variables)]
|
||||||
fn main() {
|
fn main() {
|
||||||
// You can have clap pull the application version directly from your Cargo.toml starting with
|
// 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:
|
// 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};
|
use clap::{App, Arg};
|
||||||
|
|
||||||
|
#[allow(unused_variables)]
|
||||||
fn main() {
|
fn main() {
|
||||||
// You can get a "default value" like feature by using Option<T>'s .unwrap_or() method
|
// 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};
|
use clap::{App, Arg};
|
||||||
|
|
||||||
|
#[allow(unused_variables)]
|
||||||
fn main() {
|
fn main() {
|
||||||
// You can define a function (or a closure) to use as a validator to argument values. The
|
// 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
|
// 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};
|
use clap::{App, AppSettings, SubCommand};
|
||||||
|
|
||||||
|
#[allow(unused_variables)]
|
||||||
fn main() {
|
fn main() {
|
||||||
// You can use AppSettings to change the application level behavior of clap. .setting() function
|
// 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
|
// 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::collections::HashSet;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue