Skip to content

Commit 475a4e4

Browse files
committed
fix: rename omit_usage to hidden_help
1 parent 6c8f075 commit 475a4e4

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

argh/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
//! Programs that are run from an environment such as cargo may find it
295295
//! useful to have positional arguments present in the structure but
296296
//! omitted from the usage output. This can be accomplished by adding
297-
//! the `omit_usage` attribute to that argument:
297+
//! the `hidden_help` attribute to that argument:
298298
//!
299299
//! ```rust
300300
//! # use argh::FromArgs;
@@ -304,10 +304,10 @@
304304
//! struct CargoArgs {
305305
//! // Cargo puts the command name invoked into the first argument,
306306
//! // so we don't want this argument to show up in the usage text.
307-
//! #[argh(positional, omit_usage)]
307+
//! #[argh(positional, hidden_help)]
308308
//! command: String,
309309
//! /// An option used for internal debugging
310-
//! #[argh(option, omit_usage)]
310+
//! #[argh(option, hidden_help)]
311311
//! internal_debugging: String
312312
//! #[argh(positional)]
313313
//! real_first_arg: String,

argh/tests/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,18 +1175,18 @@ Options:
11751175
}
11761176

11771177
#[test]
1178-
fn omit_usage_attribute() {
1178+
fn hidden_help_attribute() {
11791179
#[derive(FromArgs)]
11801180
/// Short description
11811181
struct Cmd {
11821182
/// this one should be hidden
1183-
#[argh(positional, omit_usage)]
1183+
#[argh(positional, hidden_help)]
11841184
_one: String,
11851185
#[argh(positional)]
11861186
/// this one is real
11871187
_two: String,
11881188
/// this one should be hidden
1189-
#[argh(option, omit_usage)]
1189+
#[argh(option, hidden_help)]
11901190
_three: String,
11911191
}
11921192

argh_derive/src/help.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(crate) fn help(
3131
let mut format_lit = "Usage: {command_name}".to_string();
3232

3333
let positional = fields.iter().filter(|f| {
34-
f.kind == FieldKind::Positional && f.attrs.greedy.is_none() && !f.attrs.omit_usage
34+
f.kind == FieldKind::Positional && f.attrs.greedy.is_none() && !f.attrs.hidden_help
3535
});
3636
let mut has_positional = false;
3737
for arg in positional.clone() {
@@ -40,14 +40,14 @@ pub(crate) fn help(
4040
positional_usage(&mut format_lit, arg);
4141
}
4242

43-
let options = fields.iter().filter(|f| f.long_name.is_some() && !f.attrs.omit_usage);
43+
let options = fields.iter().filter(|f| f.long_name.is_some() && !f.attrs.hidden_help);
4444
for option in options.clone() {
4545
format_lit.push(' ');
4646
option_usage(&mut format_lit, option);
4747
}
4848

4949
let remain = fields.iter().filter(|f| {
50-
f.kind == FieldKind::Positional && f.attrs.greedy.is_some() && !f.attrs.omit_usage
50+
f.kind == FieldKind::Positional && f.attrs.greedy.is_some() && !f.attrs.hidden_help
5151
});
5252
for arg in remain {
5353
format_lit.push(' ');

argh_derive/src/parse_attrs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct FieldAttrs {
1919
pub short: Option<syn::LitChar>,
2020
pub arg_name: Option<syn::LitStr>,
2121
pub greedy: Option<syn::Path>,
22-
pub omit_usage: bool,
22+
pub hidden_help: bool,
2323
}
2424

2525
/// The purpose of a particular field on a `#![derive(FromArgs)]` struct.
@@ -124,15 +124,15 @@ impl FieldAttrs {
124124
);
125125
} else if name.is_ident("greedy") {
126126
this.greedy = Some(name.clone());
127-
} else if name.is_ident("omit_usage") {
128-
this.omit_usage = true;
127+
} else if name.is_ident("hidden_help") {
128+
this.hidden_help = true;
129129
} else {
130130
errors.err(
131131
&meta,
132132
concat!(
133133
"Invalid field-level `argh` attribute\n",
134134
"Expected one of: `arg_name`, `default`, `description`, `from_str_fn`, `greedy`, ",
135-
"`long`, `option`, `short`, `subcommand`, `switch`, `omit_usage`",
135+
"`long`, `option`, `short`, `subcommand`, `switch`, `hidden_help`",
136136
),
137137
);
138138
}

0 commit comments

Comments
 (0)