Skip to content

Commit

Permalink
docs: Fix some typos and markdown issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Mar 3, 2018
1 parent cd046a7 commit 935ba0d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ Minimum version of Rust is now v1.13.0 (Stable)

#### Bug Fixes

* **Low Index Multiples:** fixes a bug where using low index multiples was propgated to subcommands ([33924e88](https://github.com/kbknapp/clap-rs/commit/33924e884461983c4e6b5ea1330fecc769a4ade7), closes [#725](https://github.com/kbknapp/clap-rs/issues/725))
* **Low Index Multiples:** fixes a bug where using low index multiples was propagated to subcommands ([33924e88](https://github.com/kbknapp/clap-rs/commit/33924e884461983c4e6b5ea1330fecc769a4ade7), closes [#725](https://github.com/kbknapp/clap-rs/issues/725))



Expand Down
4 changes: 2 additions & 2 deletions src/app/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ fn copy_and_capture<R: Read, W: Write>(

// The end of the reader was found without finding the closing tag.
// Write the opening byte and captured text to the writer.
// Return 0 indicating that nothing was caputred but the reader still contains data.
// Return 0 indicating that nothing was captured but the reader still contains data.
DelimiterNotFound(not_tag_length) => match w.write(b"{") {
Err(e) => Some(Err(e)),
_ => match w.write(&tag_buffer.get_ref()[0..not_tag_length]) {
Expand Down Expand Up @@ -884,7 +884,7 @@ impl<'a> Help<'a> {
let mut tmplr = Cursor::new(&template);
let mut tag_buf = Cursor::new(vec![0u8; 15]);

// The strategy is to copy the template from the the reader to wrapped stream
// The strategy is to copy the template from the reader to wrapped stream
// until a tag is found. Depending on its value, the appropriate content is copied
// to the wrapped stream.
// The copy from template is then resumed, repeating this sequence until reading
Expand Down
14 changes: 7 additions & 7 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ impl<'a, 'b> App<'a, 'b> {
self
}

/// Adds multiple [arguments] to the list of valid possibilties
/// Adds multiple [arguments] to the list of valid possibilities
///
/// # Examples
///
Expand Down Expand Up @@ -976,7 +976,7 @@ impl<'a, 'b> App<'a, 'b> {
/// Meaning any of the arguments that belong to that group will cause a failure if present with
/// the conflicting argument.
///
/// Another added benfit of [`ArgGroup`]s is that you can extract a value from a group instead
/// Another added benefit of [`ArgGroup`]s is that you can extract a value from a group instead
/// of determining exactly which argument was used.
///
/// Finally, using [`ArgGroup`]s to ensure exclusion between arguments is another very common
Expand Down Expand Up @@ -1156,7 +1156,7 @@ impl<'a, 'b> App<'a, 'b> {
/// [`-h` (short)]: ./struct.Arg.html#method.help
/// [`--help` (long)]: ./struct.Arg.html#method.long_help
pub fn print_help(&mut self) -> ClapResult<()> {
// If there are global arguments, or settings we need to propgate them down to subcommands
// If there are global arguments, or settings we need to propagate them down to subcommands
// before parsing incase we run into a subcommand
self.p.propagate_globals();
self.p.propagate_settings();
Expand Down Expand Up @@ -1186,7 +1186,7 @@ impl<'a, 'b> App<'a, 'b> {
/// [`-h` (short)]: ./struct.Arg.html#method.help
/// [`--help` (long)]: ./struct.Arg.html#method.long_help
pub fn print_long_help(&mut self) -> ClapResult<()> {
// If there are global arguments, or settings we need to propgate them down to subcommands
// If there are global arguments, or settings we need to propagate them down to subcommands
// before parsing incase we run into a subcommand
self.p.propagate_globals();
self.p.propagate_settings();
Expand All @@ -1206,7 +1206,7 @@ impl<'a, 'b> App<'a, 'b> {
///
/// **NOTE:** There is a known bug where this method does not write propagated global arguments
/// or autogenerated arguments (i.e. the default help/version args). Prefer
/// [`App::write_long_help`] instead if possibe!
/// [`App::write_long_help`] instead if possible!
///
/// # Examples
///
Expand All @@ -1223,7 +1223,7 @@ impl<'a, 'b> App<'a, 'b> {
pub fn write_help<W: Write>(&self, w: &mut W) -> ClapResult<()> {
// PENDING ISSUE: 808
// https://github.com/kbknapp/clap-rs/issues/808
// If there are global arguments, or settings we need to propgate them down to subcommands
// If there are global arguments, or settings we need to propagate them down to subcommands
// before parsing incase we run into a subcommand
// self.p.propagate_globals();
// self.p.propagate_settings();
Expand Down Expand Up @@ -1596,7 +1596,7 @@ impl<'a, 'b> App<'a, 'b> {
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
{
// If there are global arguments, or settings we need to propgate them down to subcommands
// If there are global arguments, or settings we need to propagate them down to subcommands
// before parsing incase we run into a subcommand
if !self.p.is_set(AppSettings::Propagated) {
self.p.propagate_globals();
Expand Down
4 changes: 2 additions & 2 deletions src/app/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ pub enum AppSettings {
DeriveDisplayOrder,

/// Specifies to use the version of the current command for all child [`SubCommand`]s.
/// (Defaults to `false`; subcommands have independant version strings from their parents.)
/// (Defaults to `false`; subcommands have independent version strings from their parents.)
///
/// **NOTE:** The version for the current command **and** this setting must be set **prior** to
/// adding any child subcommands
Expand Down Expand Up @@ -553,7 +553,7 @@ pub enum AppSettings {
/// designing CLIs which allow inferred subcommands and have potential positional/free
/// arguments whose values could start with the same characters as subcommands. If this is the
/// case, it's recommended to use settings such as [`AppSeettings::ArgsNegateSubcommands`] in
/// conjuction with this setting.
/// conjunction with this setting.
///
/// # Examples
///
Expand Down
20 changes: 10 additions & 10 deletions src/args/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ impl<'a, 'b> Arg<'a, 'b> {
/// **WARNING:**
///
/// When using args with `multiple(true)` on [options] or [positionals] (i.e. those args that
/// accept values) and [subcommands], one needs to consider the posibility of an argument value
/// accept values) and [subcommands], one needs to consider the possibility of an argument value
/// being the same as a valid subcommand. By default `clap` will parse the argument in question
/// as a value *only if* a value is possible at that moment. Otherwise it will be parsed as a
/// subcommand. In effect, this means using `multiple(true)` with no additional parameters and
Expand Down Expand Up @@ -2049,7 +2049,7 @@ impl<'a, 'b> Arg<'a, 'b> {
/// let files: Vec<_> = m.values_of("file").unwrap().collect();
/// assert_eq!(files, ["file1", "file2", "file3"]);
/// ```
/// This is functionally equivilant to the example above
/// This is functionally equivalent to the example above
///
/// ```rust
/// # use clap::{App, Arg};
Expand Down Expand Up @@ -2220,7 +2220,7 @@ impl<'a, 'b> Arg<'a, 'b> {
/// # ;
/// ```
///
/// For example, assume an appliction with two subcommands, and you'd like to define a
/// For example, assume an application with two subcommands, and you'd like to define a
/// `--verbose` flag that can be called on any of the subcommands and parent, but you don't
/// want to clutter the source with three duplicate [`Arg`] definitions.
///
Expand Down Expand Up @@ -2727,9 +2727,9 @@ impl<'a, 'b> Arg<'a, 'b> {
///
/// **NOTE:** This does *not* implicitly set [`Arg::multiple(true)`]. This is because
/// `-o val -o val` is multiple occurrences but a single value and `-o val1 val2` is a single
/// occurence with multiple values. For positional arguments this **does** set
/// occurrence with multiple values. For positional arguments this **does** set
/// [`Arg::multiple(true)`] because there is no way to determine the difference between multiple
/// occurences and multiple values.
/// occurrences and multiple values.
///
/// # Examples
///
Expand Down Expand Up @@ -2790,9 +2790,9 @@ impl<'a, 'b> Arg<'a, 'b> {
///
/// **NOTE:** This does not implicitly set [`Arg::multiple(true)`]. This is because
/// `-o val -o val` is multiple occurrences but a single value and `-o val1 val2` is a single
/// occurence with multiple values. For positional arguments this **does** set
/// occurrence with multiple values. For positional arguments this **does** set
/// [`Arg::multiple(true)`] because there is no way to determine the difference between multiple
/// occurences and multiple values.
/// occurrences and multiple values.
///
/// # Examples
///
Expand Down Expand Up @@ -3187,7 +3187,7 @@ impl<'a, 'b> Arg<'a, 'b> {
/// **NOTE:** This implicitly sets [`Arg::takes_value(true)`].
///
/// **NOTE:** This setting effectively disables `AppSettings::ArgRequiredElseHelp` if used in
/// conjuction as it ensures that some argument will always be present.
/// conjunction as it ensures that some argument will always be present.
///
/// # Examples
///
Expand Down Expand Up @@ -3429,7 +3429,7 @@ impl<'a, 'b> Arg<'a, 'b> {
/// ```
///
/// We can also see that these values are applied in order, and if more than one condition is
/// true, only the first evaluatd "wins"
/// true, only the first evaluated "wins"
///
/// ```rust
/// # use clap::{App, Arg};
Expand Down Expand Up @@ -3484,7 +3484,7 @@ impl<'a, 'b> Arg<'a, 'b> {
/// will return `0` even though the [`ArgMatches::value_of`] will return the default specified.
///
/// **NOTE:** If the user *does not* use this argument at runtime [`ArgMatches::is_present`] will
/// return `true` if the variable is present in the environemnt . If you wish to determine whether
/// return `true` if the variable is present in the environment . If you wish to determine whether
/// the argument was used at runtime or not, consider [`ArgMatches::occurrences_of`] which will
/// return `0` if the argument was *not* used at runtime.
///
Expand Down
3 changes: 2 additions & 1 deletion src/args/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ impl Default for ArgFlags {

/// Various settings that apply to arguments and may be set, unset, and checked via getter/setter
/// methods [`Arg::set`], [`Arg::unset`], and [`Arg::is_set`]
///
/// [`Arg::set`]: ./struct.Arg.html#method.set
/// [`Arg::unset`]: ./struct.Arg.html#method.unset
/// [`Arg::is_set`]: ./struct.Arg.html#method.is_set
Expand All @@ -79,7 +80,7 @@ pub enum ArgSettings {
Hidden,
/// The argument accepts a value, such as `--option <value>`
TakesValue,
/// Determines if the argument allows values to be grouped via a delimter
/// Determines if the argument allows values to be grouped via a delimiter
UseValueDelimiter,
/// Prints the help text on the line after the argument
NextLineHelp,
Expand Down
7 changes: 4 additions & 3 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use fmt::{ColorWhen, Colorizer, ColorizerOption};
use suggestions;

/// Short hand for [`Result`] type
///
/// [`Result`]: https://doc.rust-lang.org/std/result/enum.Result.html
pub type Result<T> = StdResult<T, Error>;

Expand Down Expand Up @@ -77,7 +78,7 @@ pub enum ErrorKind {

/// Occurs when the user provides an unrecognized [`SubCommand`] which either
/// doesn't meet the threshold for being similar enough to an existing subcommand,
/// or the 'sggestions' feature is disabled.
/// or the 'suggestions' feature is disabled.
/// Otherwise the more detailed [`InvalidSubcommand`] error is returned.
///
/// This error typically happens when passing additional subcommand names to the `help`
Expand Down Expand Up @@ -294,7 +295,7 @@ pub enum ErrorKind {
/// Occurs when the user provides a value containing invalid UTF-8 for an argument and
/// [`AppSettings::StrictUtf8`] is set.
///
/// # Platform Speicific
/// # Platform Specific
///
/// Non-Windows platforms only (such as Linux, Unix, OSX, etc.)
///
Expand Down Expand Up @@ -372,7 +373,7 @@ pub enum ErrorKind {
/// Command Line Argument Parser Error
#[derive(Debug)]
pub struct Error {
/// Formated error message
/// Formatted error message
pub message: String,
/// The type of error
pub kind: ErrorKind,
Expand Down
6 changes: 3 additions & 3 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
///
/// # Examples
///
/// The following example shows how to load a properly formatted YAML file to build an instnace
/// The following example shows how to load a properly formatted YAML file to build an instance
/// of an `App` struct.
///
/// ```ignore
Expand Down Expand Up @@ -607,10 +607,10 @@ macro_rules! app_from_crate {
/// * Three dots (`...`) sets [`Arg::multiple(true)`]
/// * Angled brackets after either a short or long will set [`Arg::value_name`] and
/// `Arg::required(true)` such as `--config <FILE>` = `Arg::value_name("FILE")` and
/// `Arg::required(true)
/// `Arg::required(true)`
/// * Square brackets after either a short or long will set [`Arg::value_name`] and
/// `Arg::required(false)` such as `--config [FILE]` = `Arg::value_name("FILE")` and
/// `Arg::required(false)
/// `Arg::required(false)`
/// * There are short hand syntaxes for Arg methods that accept booleans
/// * A plus sign will set that method to `true` such as `+required` = `Arg::required(true)`
/// * An exclamation will set that method to `false` such as `!required` = `Arg::required(false)`
Expand Down

0 comments on commit 935ba0d

Please sign in to comment.