Skip to content

Commit 3cfbec3

Browse files
committed
truncate: Apply localization update
1 parent 04f9e86 commit 3cfbec3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/uu/truncate/src/truncate.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::io::ErrorKind;
1111
#[cfg(unix)]
1212
use std::os::unix::fs::FileTypeExt;
1313
use std::path::Path;
14+
use uucore::clap_localization::{ArgHelpLocalization, CommandHelpLocalization};
1415
use uucore::display::Quotable;
1516
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
1617
use uucore::format_usage;
@@ -109,33 +110,32 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
109110
}
110111

111112
pub fn uu_app() -> Command {
112-
let cmd = Command::new(uucore::util_name())
113+
Command::new(uucore::util_name())
113114
.version(uucore::crate_version!())
114115
.about(translate!("truncate-about"))
115116
.override_usage(format_usage(&translate!("truncate-usage")))
116117
.after_help(translate!("truncate-after-help"))
117-
.infer_long_args(true);
118-
uucore::clap_localization::configure_localized_command(cmd)
118+
.infer_long_args(true)
119119
.arg(
120120
Arg::new(options::IO_BLOCKS)
121121
.short('o')
122122
.long(options::IO_BLOCKS)
123-
.help(translate!("truncate-help-io-blocks"))
123+
.help_localized(translate!("truncate-help-io-blocks"))
124124
.action(ArgAction::SetTrue),
125125
)
126126
.arg(
127127
Arg::new(options::NO_CREATE)
128128
.short('c')
129129
.long(options::NO_CREATE)
130-
.help(translate!("truncate-help-no-create"))
130+
.help_localized(translate!("truncate-help-no-create"))
131131
.action(ArgAction::SetTrue),
132132
)
133133
.arg(
134134
Arg::new(options::REFERENCE)
135135
.short('r')
136136
.long(options::REFERENCE)
137137
.required_unless_present(options::SIZE)
138-
.help(translate!("truncate-help-reference"))
138+
.help_localized(translate!("truncate-help-reference"))
139139
.value_name("RFILE")
140140
.value_hint(clap::ValueHint::FilePath),
141141
)
@@ -144,7 +144,7 @@ pub fn uu_app() -> Command {
144144
.short('s')
145145
.long(options::SIZE)
146146
.required_unless_present(options::REFERENCE)
147-
.help(translate!("truncate-help-size"))
147+
.help_localized(translate!("truncate-help-size"))
148148
.allow_hyphen_values(true)
149149
.value_name("SIZE"),
150150
)
@@ -156,6 +156,8 @@ pub fn uu_app() -> Command {
156156
.value_hint(clap::ValueHint::FilePath)
157157
.value_parser(clap::value_parser!(OsString)),
158158
)
159+
.localize_help_and_version()
160+
.localize_help_template()
159161
}
160162

161163
/// Truncate the named file to the specified size.

0 commit comments

Comments
 (0)