Fix a bunch of typos in comments

This commit is contained in:
Ben S 2015-11-01 14:02:37 +00:00
parent aa02706d04
commit 00b61ae226
10 changed files with 66 additions and 66 deletions

View file

@ -37,8 +37,8 @@ If you're already familiar with `clap` but just want to see some new highlights
* **Major Bug Fixes in 1.4.6** We recommend everyone upgrade as soon as possible. See the [the changelog](https://github.com/kbknapp/clap-rs/blob/master/CHANGELOG.md) for details.
* Using `get_matches_safe_*` family of methods no longer exits the process when help or version is displayed, instead it returns an `ClapError` with an `error_type` field set to `ClapErrorType::HelpDisplayed` or `ClapErrorType::VersionDisplayed` respectively. You must then call `ClapError::exit` or `std::process::exit` giving you the control.
* Allows parsing without a binary name preceeding (useful for daemon modes and interactive CLIs)
* `-Lvalue` style options are **now supported**! (i.e. `-L` is the short, and `value` is the value being passed. Equivilant to `-L value`). This can be combined with flag expansion. Example: `-lF2` could be parsed as `-l -F 2` where `-l` is a flag and `-F` is an option that takes a number.
* Allows parsing without a binary name preceding (useful for daemon modes and interactive CLIs)
* `-Lvalue` style options are **now supported**! (i.e. `-L` is the short, and `value` is the value being passed. Equivalent to `-L value`). This can be combined with flag expansion. Example: `-lF2` could be parsed as `-l -F 2` where `-l` is a flag and `-F` is an option that takes a number.
* There is a **new opt-in setting** (`AppSettings::TrailingVarArg`) to allow the final positional argument to be a vararg and have `clap` not interpret the remaining arguments (i.e. useful when final argument should be a list of arguments for another command or process)
* You can now access values from an argument in a group via the group name, instead of having to check each arg name individually to find out which one was used. The same applies for checking if an arg from a group `is_present()`
* You now have the option to **not** `panic!` on invalid unicode. The `*_safe()` family of `get_matches` will return an `Err` with `ClapErrorType::InvalidUnicode`.
@ -72,20 +72,20 @@ First, let me say that these comparisons are highly subjective, and not meant in
`getopts` is a very basic, fairly minimalist argument parsing library. This isn't a bad thing, sometimes you don't need tons of features, you just want to parse some simple arguments, and have some help text generated for you based on valid arguments you specify. When using `getopts` you must manually implement most of the common features (such as checking to display help messages, usage strings, etc.). If you want a highly custom argument parser, and don't mind writing most the argument parser yourself, `getopts` is an excellent base.
Due to it's lack of features, `getopts` also doesn't allocate much, or at all. This gives it somewhat of a performance boost. Although, as you start implementing those features you need manually, that boost quickly dissapears.
Due to it's lack of features, `getopts` also doesn't allocate much, or at all. This gives it somewhat of a performance boost. Although, as you start implementing those features you need manually, that boost quickly disappears.
Personally, I find many, many people that use `getopts` are manually implementing features that `clap` has by default. Using `clap` simplifies your codebase allowing you to focus on your application, and not argument parsing.
Reasons to use `getopts` instead of `clap`
* You need a few allocations as possible, don't plan on implmenting any additional features
* You need a few allocations as possible, don't plan on implementing any additional features
* You want a highly custom argument parser, but want to use an established parser as a base
#### How does `clap` compare to [docopt.rs](https://github.com/docopt/docopt.rs)?
I first want to say I'm a big a fan of BurntSuhsi's work, the creator of `Docopt.rs`. I aspire to produce the quality of libraries that this man does! When it comes to comparing these two libraries they are very different. `docopt` tasks you with writing a help message, and then it parsers that message for you to determine all valid arguments and their use. Some people LOVE this, others not so much. If you're willing to write a detailed help message, it's nice that you can stick that in your program and have `docopt` do the rest. On the downside, it's somewhat less flexible than other options out there, and requires the help message change if you need to make changes.
I first want to say I'm a big a fan of BurntSushi's work, the creator of `Docopt.rs`. I aspire to produce the quality of libraries that this man does! When it comes to comparing these two libraries they are very different. `docopt` tasks you with writing a help message, and then it parsers that message for you to determine all valid arguments and their use. Some people LOVE this, others not so much. If you're willing to write a detailed help message, it's nice that you can stick that in your program and have `docopt` do the rest. On the downside, it's somewhat less flexible than other options out there, and requires the help message change if you need to make changes.
`docopt` is also excellent at translating arguments into Rust types automatically. There is even a syntax extension which will do all this for you, if you're willing to use a nightly compiler (use of a stable compiler requires you to manually translate from arguments to Rust types). To use BurntSushi's words, `docopt` is also somewhat of a black box. You get what you get, and it's hard to tweak implmementation or customise your experience for your use case.
`docopt` is also excellent at translating arguments into Rust types automatically. There is even a syntax extension which will do all this for you, if you're willing to use a nightly compiler (use of a stable compiler requires you to manually translate from arguments to Rust types). To use BurntSushi's words, `docopt` is also somewhat of a black box. You get what you get, and it's hard to tweak implementation or customise your experience for your use case.
Because `docopt` is doing a ton of work to parse your help messages and determine what you were trying to communicate as valid arguments, it's also one of the more heavy weight parsers performance-wise. For most applications this isn't a concern, but it's something to keep in mind.
@ -329,7 +329,7 @@ fn main() {
}
```
This final method shows how you can use a YAML file to build your CLI and keep your Rust source tidy. First, create the `cli.yml` file to hold your CLI options, but it could be called anything we like (we'll use the same both examples above to keep it functionally equivilant):
This final method shows how you can use a YAML file to build your CLI and keep your Rust source tidy. First, create the `cli.yml` file to hold your CLI options, but it could be called anything we like (we'll use the same both examples above to keep it functionally equivalent):
```yaml
name: myapp

View file

@ -46,7 +46,7 @@ const INTERNAL_ERROR_MSG: &'static str = "Fatal internal error. Please consider
/// .arg(
/// Arg::with_name("in_file").index(1)
/// )
/// .after_help("Longer explaination to appear after the options when \
/// .after_help("Longer explanation to appear after the options when \
/// displaying the help information from --help or -h")
/// .get_matches();
///
@ -135,14 +135,14 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
}
}
/// Creates a new instace of `App` from a .yml (YAML) file. The YAML file must be properly
/// Creates a new instance of `App` from a .yml (YAML) file. The YAML file must be properly
/// formatted or this function will panic!(). A full example of supported YAML objects can be
/// found in `examples/17_yaml.rs` and `examples/17_yaml.yml`.
///
/// In order to use this function you must compile with the `features = ["yaml"]` in your
/// settings for `[dependencies.clap]` table of your `Cargo.toml`
///
/// Note, due to how the YAML objects are built there is a convienience macro for loading the
/// Note, due to how the YAML objects are built there is a convenience macro for loading the
/// YAML file (relative to the current file, like modules work). That YAML object can then be
/// passed to this function.
///
@ -240,7 +240,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
}
/// Overrides the system-determined binary name. This should only be used when absolutely
/// neccessary, such as the binary name for your application is misleading, or perhaps *not*
/// necessary, such as the binary name for your application is misleading, or perhaps *not*
/// how the user should invoke your program.
///
/// **NOTE:** This command **should not** be used for SubCommands.
@ -405,10 +405,10 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
/// Does awesome things\n\
/// (C) me@mail.com\n\n\
///
/// USAGE: myapp <opts> <comamnd>\n\n\
/// USAGE: myapp <opts> <command>\n\n\
///
/// Options:\n\
/// -h, --helpe Dispay this message\n\
/// -h, --help Display this message\n\
/// -V, --version Display version info\n\
/// -s <stuff> Do something with stuff\n\
/// -v Be verbose\n\n\
@ -428,7 +428,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
/// By default `clap` automatically assigns `h`, but this can be overridden
///
/// **NOTE:** Any leading `-` characters will be stripped, and only the first
/// non `-` chacter will be used as the `short` version
/// non `-` character will be used as the `short` version
///
///
/// # Examples
@ -451,7 +451,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
/// By default `clap` automatically assigns `V`, but this can be overridden
///
/// **NOTE:** Any leading `-` characters will be stripped, and only the first
/// non `-` chacter will be used as the `short` version
/// non `-` character will be used as the `short` version
///
///
/// # Examples
@ -469,7 +469,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
self
}
/// Specifies that the help text sould be displayed (and then exit gracefully), if no
/// Specifies that the help text should be displayed (and then exit gracefully), if no
/// arguments are present at runtime (i.e. an empty run such as, `$ myprog`.
///
/// **Deprecated:** Use `App::setting()` with `AppSettings::ArgRequiredElseHelp` instead. This
@ -635,7 +635,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
self
}
/// Specifies that the help text sould be displayed (and then exit gracefully), if no
/// Specifies that the help text should be displayed (and then exit gracefully), if no
/// subcommands are present at runtime (i.e. an empty run such as, `$ myprog`.
///
/// **Deprecated:** Use `App::setting()` with `AppSettings::SubcommandRequiredElseHelp`
@ -699,7 +699,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
self
}
/// Adds an argument to the list of valid possibilties manually. This method allows you full
/// Adds an argument to the list of valid possibilities manually. This method allows you full
/// control over the arguments settings and options (as well as dynamic generation). It also
/// allows you specify several more advanced configuration options such as relational rules
/// (exclusions and requirements).
@ -798,7 +798,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
}
}
/// Adds multiple arguments to the list of valid possibilties by iterating over a Vec of Args
/// Adds multiple arguments to the list of valid possibilities by iterating over a Vec of Args
///
///
/// # Examples
@ -819,7 +819,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
self
}
/// A convienience method for adding a single basic argument (one without advanced
/// A convenience method for adding a single basic argument (one without advanced
/// relational rules) from a usage type string. The string used follows the same rules and
/// syntax as `Arg::from_usage()`
///
@ -969,7 +969,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
self
}
/// Adds a subcommand to the list of valid possibilties. Subcommands are effectively sub apps,
/// Adds a subcommand to the list of valid possibilities. Subcommands are effectively sub apps,
/// because they can contain their own arguments, subcommands, version, usage, etc. They also
/// function just like apps, in that they get their own auto generated help, version, and
/// usage.
@ -1001,7 +1001,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
self
}
/// Adds multiple subcommands to the list of valid possibilties by iterating over a Vec of
/// Adds multiple subcommands to the list of valid possibilities by iterating over a Vec of
/// `SubCommand`s
///
/// # Examples
@ -1335,7 +1335,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
/// Prints the full help message to `io::stdout()` using a `BufWriter`
///
/// # Exampless
/// # Examples
/// ```no_run
/// # use clap::App;
/// # use std::io;
@ -1710,7 +1710,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
/// the real parsing function for all subcommands. Invalid unicode characters are replaced with
/// `U+FFFD REPLACEMENT CHARACTER`
///
/// # Exampless
/// # Examples
///
/// ```no_run
/// # use clap::{App, Arg};
@ -2313,7 +2313,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
} else {
// Positional or Subcommand
//
// If the user pased `--` we don't check for subcommands, because the argument
// If the user passed `--` we don't check for subcommands, because the argument
// they
// may be trying to pass might match a subcommand name
if !pos_only {

View file

@ -39,7 +39,7 @@ pub enum ClapErrorType {
/// ```no_run
/// # use clap::{App, Arg, SubCommand};
/// let result = App::new("myprog")
/// .subcommand(SubCommand::with_name("conifg")
/// .subcommand(SubCommand::with_name("config")
/// .about("Used for configuration")
/// .arg(Arg::with_name("config_file")
/// .help("The configuration file to use")
@ -152,7 +152,7 @@ pub enum ClapErrorType {
/// # use clap::{App, Arg, AppSettings, SubCommand};
/// let result = App::new("myprog")
/// .setting(AppSettings::SubcommandRequired)
/// .subcommand(SubCommand::with_name("conifg")
/// .subcommand(SubCommand::with_name("config")
/// .about("Used for configuration")
/// .arg(Arg::with_name("config_file")
/// .help("The configuration file to use")
@ -170,7 +170,7 @@ pub enum ClapErrorType {
/// # use clap::{App, Arg, AppSettings, SubCommand};
/// let result = App::new("myprog")
/// .setting(AppSettings::ArgRequiredElseHelp)
/// .subcommand(SubCommand::with_name("conifg")
/// .subcommand(SubCommand::with_name("config")
/// .about("Used for configuration")
/// .arg(Arg::with_name("config_file")
/// .help("The configuration file to use")

View file

@ -121,7 +121,7 @@ pub enum AppSettings {
/// # ;
/// ```
SubcommandRequired,
/// Specifies that the help text sould be displayed (and then exit gracefully), if no
/// Specifies that the help text should be displayed (and then exit gracefully), if no
/// arguments are present at runtime (i.e. an empty run such as, `$ myprog`.
///
/// **NOTE:** Subcommands count as arguments
@ -210,7 +210,7 @@ pub enum AppSettings {
/// # ;
/// ```
WaitOnError,
/// Specifies that the help text sould be displayed (and then exit gracefully), if no
/// Specifies that the help text should be displayed (and then exit gracefully), if no
/// subcommands are present at runtime (i.e. an empty run such as, `$ myprog`.
///
/// **NOTE:** This should *not* be used with `.subcommand_required()` as they do the same
@ -247,7 +247,7 @@ pub enum AppSettings {
/// The values of the trailing positional argument will contain all args from itself on.
///
/// **NOTE:** The final positional argument **must** have `.multiple(true)` or usage token
/// equivilant.
/// equivalent.
///
/// # Examples
///

View file

@ -99,7 +99,7 @@ pub struct Arg<'n, 'l, 'h, 'g, 'p, 'r> {
}
impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
/// Creates a new instace of `Arg` using a unique string name.
/// Creates a new instance of `Arg` using a unique string name.
/// The name will be used by the library consumer to get information about
/// whether or not the argument was used at runtime.
///
@ -143,7 +143,7 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
}
}
/// Creates a new instace of `Arg` from a .yml (YAML) file.
/// Creates a new instance of `Arg` from a .yml (YAML) file.
///
/// # Examples
///
@ -225,17 +225,17 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
a
}
/// Creates a new instace of `Arg` from a usage string. Allows creation of basic settings
/// Creates a new instance of `Arg` from a usage string. Allows creation of basic settings
/// for Arg (i.e. everything except relational rules). The syntax is flexible, but there are
/// some rules to follow.
///
/// **NOTE**: only properties which you wish to set must be present
///
/// 1. Name (arguments with a `long` or that take a value can ommit this if desired),
/// 1. Name (arguments with a `long` or that take a value can omit this if desired),
/// use `[]` for non-required arguments, or `<>` for required arguments.
/// 2. Short preceded by a `-`
/// 3. Long preceded by a `--` (this may be used as the name, if the name is omitted. If the
/// name is *not* omittied, the name takes precedence over the `long`)
/// name is *not* omitted, the name takes precedence over the `long`)
/// 4. Value (this can be used as the name if the name is not manually specified. If the name
/// is manually specified, it takes precedence. If this value is used as the name, it uses
/// the same `[]` and `<>` requirement specification rules. If it is *not* used as the name,
@ -403,7 +403,7 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
/// will not assign those to the displaying of version or help.
///
/// **NOTE:** Any leading `-` characters will be stripped, and only the first
/// non `-` chacter will be used as the `short` version
/// non `-` character will be used as the `short` version
///
///
/// # Examples
@ -463,7 +463,7 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
}
/// Sets whether or not the argument is required by default. Required by
/// default means it is required, when no other mutually exlusive rules have
/// default means it is required, when no other mutually exclusive rules have
/// been evaluated. Mutually exclusive rules take precedence over being required
/// by default.
///
@ -584,7 +584,7 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
self
}
/// Sets an argument by name that is required when this one is presnet I.e. when
/// Sets an argument by name that is required when this one is present I.e. when
/// using this argument, the following argument *must* be present.
///
/// **NOTE:** Mutually exclusive and override rules take precedence over being required
@ -606,7 +606,7 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
self
}
/// Sets arguments by names that are required when this one is presnet I.e. when
/// Sets arguments by names that are required when this one is present I.e. when
/// using this argument, the following arguments *must* be present.
///
/// **NOTE:** Mutually exclusive and override rules take precedence over being required
@ -882,7 +882,7 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
/// if val.contains("@") {
/// Ok(())
/// } else {
/// Err(String::from("the value must contain at lesat one '@' character"))
/// Err(String::from("the value must contain at least one '@' character"))
/// }
/// })
/// # ).get_matches();
@ -900,7 +900,7 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
///
/// **NOTE:** `qty` must be > 1
///
/// **NOTE:** This implicity sets `.multiple(true)`
/// **NOTE:** This implicitly sets `.multiple(true)`
///
/// # Examples
///
@ -927,7 +927,7 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> {
/// `.min_values(2)`, and this argument would be satisfied if the user provided, 2 or more
/// values.
///
/// **NOTE:** This implicity sets `.multiple(true)`
/// **NOTE:** This implicitly sets `.multiple(true)`
///
/// **NOTE:** `qty` must be > 0
///

View file

@ -68,7 +68,7 @@ impl<'n> PosBuilder<'n> {
a.name);
}
// Create the Positional Arguemnt Builder with each HashSet = None to only
// Create the Positional Argument Builder with each HashSet = None to only
// allocate
// those that require it
let mut pb = PosBuilder {

View file

@ -7,7 +7,7 @@ use yaml_rust::Yaml;
/// `ArgGroup`s are a family of related arguments and way for you to say, "Any of these arguments".
/// By placing arguments in a logical group, you can make easier requirement and exclusion rules
/// intead of having to list each individually, or when you want a rule to apply "any but not all"
/// instead of having to list each individually, or when you want a rule to apply "any but not all"
/// arguments.
///
/// For instance, you can make an entire ArgGroup required, this means that one (and *only* one)
@ -55,7 +55,7 @@ pub struct ArgGroup<'n, 'ar> {
}
impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// Creates a new instace of `ArgGroup` using a unique string name.
/// Creates a new instance of `ArgGroup` using a unique string name.
/// The name will only be used by the library consumer and not displayed to the use.
///
/// # Examples
@ -64,7 +64,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// # use clap::{App, ArgGroup};
/// # let matches = App::new("myprog")
/// # .arg_group(
/// ArgGroup::with_name("conifg")
/// ArgGroup::with_name("config")
/// # ).get_matches();
pub fn with_name(n: &'n str) -> Self {
ArgGroup {
@ -76,7 +76,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
}
}
/// Creates a new instace of `ArgGroup` from a .yml (YAML) file.
/// Creates a new instance of `ArgGroup` from a .yml (YAML) file.
///
/// # Examples
///
@ -139,7 +139,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// # use clap::{App, ArgGroup};
/// # let matches = App::new("myprog")
/// # .arg_group(
/// # ArgGroup::with_name("conifg")
/// # ArgGroup::with_name("config")
/// .add("config")
/// # ).get_matches();
pub fn add(mut self, n: &'ar str) -> Self {
@ -159,7 +159,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// # use clap::{App, ArgGroup};
/// # let matches = App::new("myprog")
/// # .arg_group(
/// # ArgGroup::with_name("conifg")
/// # ArgGroup::with_name("config")
/// .add_all(&["config", "input", "output"])
/// # ).get_matches();
pub fn add_all(mut self, ns: &[&'ar str]) -> Self {
@ -181,7 +181,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// # use clap::{App, ArgGroup};
/// # let matches = App::new("myprog")
/// # .arg_group(
/// # ArgGroup::with_name("conifg")
/// # ArgGroup::with_name("config")
/// .required(true)
/// # ).get_matches();
pub fn required(mut self, r: bool) -> Self {
@ -202,7 +202,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// # use clap::{App, ArgGroup};
/// # let matches = App::new("myprog")
/// # .arg_group(
/// # ArgGroup::with_name("conifg")
/// # ArgGroup::with_name("config")
/// .requires("config")
/// # ).get_matches();
pub fn requires(mut self, n: &'ar str) -> Self {
@ -227,7 +227,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// # use clap::{App, ArgGroup};
/// # let matches = App::new("myprog")
/// # .arg_group(
/// # ArgGroup::with_name("conifg")
/// # ArgGroup::with_name("config")
/// .requires_all(&["config", "input"])
/// # ).get_matches();
pub fn requires_all(mut self, ns: &[&'ar str]) -> Self {
@ -250,7 +250,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// # use clap::{App, ArgGroup};
/// # let matches = App::new("myprog")
/// # .arg_group(
/// # ArgGroup::with_name("conifg")
/// # ArgGroup::with_name("config")
/// .conflicts_with("config")
/// # ).get_matches();
pub fn conflicts_with(mut self, n: &'ar str) -> Self {
@ -275,7 +275,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
/// # use clap::{App, ArgGroup};
/// # let matches = App::new("myprog")
/// # .arg_group(
/// # ArgGroup::with_name("conifg")
/// # ArgGroup::with_name("config")
/// .conflicts_with_all(&["config", "input"])
/// # ).get_matches();
pub fn conflicts_with_all(mut self, ns: &[&'ar str]) -> Self {

View file

@ -17,7 +17,7 @@ use ArgMatches;
/// # use clap::{App, Arg, SubCommand};
/// # let matches = App::new("myprog")
/// # .subcommand(
/// SubCommand::with_name("conifg")
/// SubCommand::with_name("config")
/// .about("Used for configuration")
/// .arg(Arg::with_name("config_file")
/// .help("The configuration file to use")

View file

@ -58,7 +58,7 @@
//!
//! Due to it's lack of features, `getopts` also doesn't allocate much, or at all.
//! This gives it somewhat of a performance boost. Although, as you start
//! implementing those features you need manually, that boost quickly dissapears.
//! implementing those features you need manually, that boost quickly disappears.
//!
//! Personally, I find many, many people that use `getopts` are manually
//! implementing features that `clap` has by default. Using `clap` simplifies your
@ -66,14 +66,14 @@
//!
//! Reasons to use `getopts` instead of `clap`
//!
//! * You need a few allocations as possible, don't plan on implmenting any
//! * You need a few allocations as possible, don't plan on implementing any
//! additional features
//! * You want a highly custom argument parser, but want to use an established
//! parser as a base
//!
//! #### How does `clap` compare to `docopt.rs`?
//!
//! I first want to say I'm a big a fan of BurntSuhsi's work, the creator of
//! I first want to say I'm a big a fan of BurntSushi's work, the creator of
//! [Docopt.rs](https://github.com/docopt/docopt.rs). I aspire to produce the
//! quality of libraries that this man does! When it comes to comparing these two
//! libraries they are very different. `docopt` tasks you with writing a help
@ -88,7 +88,7 @@
//! automatically. There is even a syntax extension which will do all this for you,
//! ifou to manually translate from arguments to Rust types). To use BurntSushi's
//! words, `docopt` is also somewhat of a black box. You get what you get, and it's
//! hard to tweak implmementation or customise your experience for your use case.
//! hard to tweak implementation or customise your experience for your use case.
//!
//! Because `docopt` is doing a ton of work to parse your help messages and
//! determine what you were trying to communicate as valid arguments, it's also one
@ -330,7 +330,7 @@
//! tidy. First, create the `cli.yml` file to hold your CLI options, but it
//! could be called
//! anything we like (we'll use the same both examples above to keep it
//! functionally equivilant):
//! functionally equivalent):
//!
//! ```yaml
//! name: myapp

View file

@ -52,7 +52,7 @@ macro_rules! write_spaces {
})
}
// convienience macro for remove an item from a vec
// convenience macro for remove an item from a vec
macro_rules! vec_remove {
($vec:expr, $to_rem:ident) => {
{
@ -300,7 +300,7 @@ macro_rules! value_t {
/// You can use it to get a single value `T`, or a `Vec<T>` with the `values_of()`
///
/// **NOTE:** This should only be used on required arguments, as it can be confusing to the user
/// why they are getting error messages when it appears they're entering all required argumetns.
/// why they are getting error messages when it appears they're entering all required arguments.
///
/// **NOTE:** Be cautious, as since this a macro invocation it's not exactly like
/// standard syntax.
@ -404,7 +404,7 @@ macro_rules! value_t_or_exit {
/// arguments. This enum also provides a `variants()` function which can be used to retrieve a
/// `Vec<&'static str>` of the variant names.
///
/// **NOTE:** This macro automaically implements std::str::FromStr and std::fmt::Display
/// **NOTE:** This macro automatically implements std::str::FromStr and std::fmt::Display
///
/// # Examples
///
@ -477,7 +477,7 @@ macro_rules! simple_enum {
///
/// **NOTE:** Case insensitivity is supported for ASCII characters
///
/// **NOTE:** This macro automaically implements std::str::FromStr and std::fmt::Display
/// **NOTE:** This macro automatically implements std::str::FromStr and std::fmt::Display
///
/// These enums support pub (or not) and use of the #[derive()] traits
///
@ -740,7 +740,7 @@ macro_rules! clap_app {
$($tt)*
}
};
// Yaml like function calls - used for setting varous meta directly against the app
// Yaml like function calls - used for setting various meta directly against the app
(@app ($builder:expr) ($ident:ident: $($v:expr),*) $($tt:tt)*) => {
// clap_app!{ @app ($builder.$ident($($v),*)) $($tt)* }
clap_app!{ @app