Skip to content

Commit 8e6bf6a

Browse files
authored
Merge pull request #6807 from andrewliebenow/printf-fix-arguments-in-help
printf: remove unused argument name from help
2 parents 3f694fa + d70990e commit 8e6bf6a

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/uu/printf/printf.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
<!-- spell-checker:ignore formatstring templating parameterizing each's -->
1+
<!-- spell-checker:ignore templating parameterizing each's -->
22

33
# printf
44

55
```
6-
printf FORMATSTRING [ARGUMENT]...
76
printf FORMAT [ARGUMENT]...
87
printf OPTION
98
```

src/uu/printf/src/printf.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
//
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
5+
56
#![allow(dead_code)]
6-
// spell-checker:ignore (change!) each's
7-
// spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr
87

8+
use clap::{crate_version, Arg, ArgAction, Command};
99
use std::io::stdout;
1010
use std::ops::ControlFlow;
11-
12-
use clap::{crate_version, Arg, ArgAction, Command};
1311
use uucore::error::{UResult, UUsageError};
1412
use uucore::format::{parse_spec_and_escape, FormatArgument, FormatItem};
1513
use uucore::{format_usage, help_about, help_section, help_usage};
@@ -21,16 +19,16 @@ const ABOUT: &str = help_about!("printf.md");
2119
const AFTER_HELP: &str = help_section!("after help", "printf.md");
2220

2321
mod options {
24-
pub const FORMATSTRING: &str = "FORMATSTRING";
22+
pub const FORMAT: &str = "FORMAT";
2523
pub const ARGUMENT: &str = "ARGUMENT";
2624
}
2725

2826
#[uucore::main]
2927
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
3028
let matches = uu_app().get_matches_from(args);
3129

32-
let format_string = matches
33-
.get_one::<String>(options::FORMATSTRING)
30+
let format = matches
31+
.get_one::<String>(options::FORMAT)
3432
.ok_or_else(|| UUsageError::new(1, "missing operand"))?;
3533

3634
let values: Vec<_> = match matches.get_many::<String>(options::ARGUMENT) {
@@ -40,7 +38,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
4038

4139
let mut format_seen = false;
4240
let mut args = values.iter().peekable();
43-
for item in parse_spec_and_escape(format_string.as_ref()) {
41+
for item in parse_spec_and_escape(format.as_ref()) {
4442
if let Ok(FormatItem::Spec(_)) = item {
4543
format_seen = true;
4644
}
@@ -57,7 +55,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
5755
}
5856

5957
while args.peek().is_some() {
60-
for item in parse_spec_and_escape(format_string.as_ref()) {
58+
for item in parse_spec_and_escape(format.as_ref()) {
6159
match item?.write(stdout(), &mut args)? {
6260
ControlFlow::Continue(()) => {}
6361
ControlFlow::Break(()) => return Ok(()),
@@ -88,6 +86,6 @@ pub fn uu_app() -> Command {
8886
.help("Print version information")
8987
.action(ArgAction::Version),
9088
)
91-
.arg(Arg::new(options::FORMATSTRING))
89+
.arg(Arg::new(options::FORMAT))
9290
.arg(Arg::new(options::ARGUMENT).action(ArgAction::Append))
9391
}

0 commit comments

Comments
 (0)