Skip to content

Commit dbfdc0f

Browse files
committed
refactor(split): Apply the new localization functions
1 parent 58f146a commit dbfdc0f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/uu/split/src/split.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::io;
2020
use std::io::{BufRead, BufReader, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write, stdin};
2121
use std::path::Path;
2222
use thiserror::Error;
23+
use uucore::clap_localization::{ArgHelpLocalization, CommandHelpLocalization};
2324
use uucore::display::Quotable;
2425
use uucore::error::{FromIo, UIoError, UResult, USimpleError, UUsageError};
2526
use uucore::translate;
@@ -227,7 +228,6 @@ fn handle_preceding_options(
227228
pub fn uu_app() -> Command {
228229
Command::new(uucore::util_name())
229230
.version(uucore::crate_version!())
230-
.help_template(uucore::localized_help_template(uucore::util_name()))
231231
.about(translate!("split-about"))
232232
.after_help(translate!("split-after-help"))
233233
.override_usage(format_usage(&translate!("split-usage")))
@@ -256,7 +256,7 @@ pub fn uu_app() -> Command {
256256
.allow_hyphen_values(true)
257257
.value_name("NUMBER")
258258
.default_value("1000")
259-
.help(translate!("split-help-lines")),
259+
.help_with_localized_default(translate!("split-help-lines")),
260260
)
261261
.arg(
262262
Arg::new(OPT_NUMBER)
@@ -274,7 +274,7 @@ pub fn uu_app() -> Command {
274274
.value_name("SUFFIX")
275275
.default_value("")
276276
.value_parser(clap::value_parser!(OsString))
277-
.help(translate!("split-help-additional-suffix")),
277+
.help_with_localized_default(translate!("split-help-additional-suffix")),
278278
)
279279
.arg(
280280
Arg::new(OPT_FILTER)
@@ -376,13 +376,17 @@ pub fn uu_app() -> Command {
376376
Arg::new(ARG_INPUT)
377377
.default_value("-")
378378
.value_hint(ValueHint::FilePath)
379-
.value_parser(clap::value_parser!(OsString)),
379+
.value_parser(clap::value_parser!(OsString))
380+
.help_with_localized_default(""),
380381
)
381382
.arg(
382383
Arg::new(ARG_PREFIX)
383384
.default_value("x")
384-
.value_parser(clap::value_parser!(OsString)),
385+
.value_parser(clap::value_parser!(OsString))
386+
.help_with_localized_default(""),
385387
)
388+
.localized_help_and_version()
389+
.localized_help_template(uucore::util_name())
386390
}
387391

388392
/// Parameters that control how a file gets split.

0 commit comments

Comments
 (0)