Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spelling: occurences -> occurrences, #158

Merged
merged 1 commit into from
Dec 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct Opt {
#[structopt(short = "d", long = "debug")]
debug: bool,

// The number of occurences of the `v/verbose` flag
// The number of occurrences of the `v/verbose` flag
/// Verbose mode (-v, -vv, -vvv, etc.)
#[structopt(short = "v", long = "verbose", parse(from_occurrences))]
verbose: u8,
Expand Down
2 changes: 1 addition & 1 deletion examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct Opt {
#[structopt(short = "d", long = "debug")]
debug: bool,

// The number of occurences of the `v/verbose` flag
// The number of occurrences of the `v/verbose` flag
/// Verbose mode (-v, -vv, -vvv, etc.)
#[structopt(short = "v", long = "verbose", parse(from_occurrences))]
verbose: u8,
Expand Down
8 changes: 4 additions & 4 deletions structopt-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn gen_augmentation(
_ => &field.ty,
};

let occurences = attrs.parser().0 == Parser::FromOccurrences;
let occurrences = attrs.parser().0 == Parser::FromOccurrences;

let validator = match *attrs.parser() {
(Parser::TryFromStr, ref f) => quote! {
Expand All @@ -152,7 +152,7 @@ fn gen_augmentation(
Ty::Bool => quote!( .takes_value(false).multiple(false) ),
Ty::Option => quote!( .takes_value(true).multiple(false) #validator ),
Ty::Vec => quote!( .takes_value(true).multiple(true) #validator ),
Ty::Other if occurences => quote!( .takes_value(false).multiple(true) ),
Ty::Other if occurrences => quote!( .takes_value(false).multiple(true) ),
Ty::Other => {
let required = !attrs.has_method("default_value");
quote!( .takes_value(true).multiple(false).required(#required) #validator )
Expand Down Expand Up @@ -214,7 +214,7 @@ fn gen_constructor(fields: &Punctuated<Field, Comma>, parent_attribute: &Attrs)
(FromOccurrences, ref f) => (quote!(occurrences_of), quote!(), f.clone()),
};

let occurences = attrs.parser().0 == Parser::FromOccurrences;
let occurrences = attrs.parser().0 == Parser::FromOccurrences;
let name = attrs.cased_name();
let field_value = match ty {
Ty::Bool => quote!(matches.is_present(#name)),
Expand All @@ -228,7 +228,7 @@ fn gen_constructor(fields: &Punctuated<Field, Comma>, parent_attribute: &Attrs)
.map(|v| v.map(#parse).collect())
.unwrap_or_else(Vec::new)
},
Ty::Other if occurences => quote! {
Ty::Other if occurrences => quote! {
#parse(matches.#value_of(#name))
},
Ty::Other => quote! {
Expand Down