Skip to content

Commit 04f9e86

Browse files
committed
split: Apply localization update
1 parent e4f68b8 commit 04f9e86

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

src/uu/split/src/split.rs

Lines changed: 21 additions & 17 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")))
@@ -239,15 +239,15 @@ pub fn uu_app() -> Command {
239239
.long(OPT_BYTES)
240240
.allow_hyphen_values(true)
241241
.value_name("SIZE")
242-
.help(translate!("split-help-bytes")),
242+
.help_localized(translate!("split-help-bytes")),
243243
)
244244
.arg(
245245
Arg::new(OPT_LINE_BYTES)
246246
.short('C')
247247
.long(OPT_LINE_BYTES)
248248
.allow_hyphen_values(true)
249249
.value_name("SIZE")
250-
.help(translate!("split-help-line-bytes")),
250+
.help_localized(translate!("split-help-line-bytes")),
251251
)
252252
.arg(
253253
Arg::new(OPT_LINES)
@@ -256,15 +256,15 @@ 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_localized(translate!("split-help-lines")),
260260
)
261261
.arg(
262262
Arg::new(OPT_NUMBER)
263263
.short('n')
264264
.long(OPT_NUMBER)
265265
.allow_hyphen_values(true)
266266
.value_name("CHUNKS")
267-
.help(translate!("split-help-number")),
267+
.help_localized(translate!("split-help-number")),
268268
)
269269
// rest of the arguments
270270
.arg(
@@ -274,21 +274,21 @@ 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_localized(translate!("split-help-additional-suffix")),
278278
)
279279
.arg(
280280
Arg::new(OPT_FILTER)
281281
.long(OPT_FILTER)
282282
.allow_hyphen_values(true)
283283
.value_name("COMMAND")
284284
.value_hint(ValueHint::CommandName)
285-
.help(translate!("split-help-filter")),
285+
.help_localized(translate!("split-help-filter")),
286286
)
287287
.arg(
288288
Arg::new(OPT_ELIDE_EMPTY_FILES)
289289
.long(OPT_ELIDE_EMPTY_FILES)
290290
.short('e')
291-
.help(translate!("split-help-elide-empty-files"))
291+
.help_localized(translate!("split-help-elide-empty-files"))
292292
.action(ArgAction::SetTrue),
293293
)
294294
.arg(
@@ -301,7 +301,7 @@ pub fn uu_app() -> Command {
301301
OPT_HEX_SUFFIXES,
302302
OPT_HEX_SUFFIXES_SHORT,
303303
])
304-
.help(translate!("split-help-numeric-suffixes-short")),
304+
.help_localized(translate!("split-help-numeric-suffixes-short")),
305305
)
306306
.arg(
307307
Arg::new(OPT_NUMERIC_SUFFIXES)
@@ -315,7 +315,7 @@ pub fn uu_app() -> Command {
315315
OPT_HEX_SUFFIXES_SHORT,
316316
])
317317
.value_name("FROM")
318-
.help(translate!("split-help-numeric-suffixes")),
318+
.help_localized(translate!("split-help-numeric-suffixes")),
319319
)
320320
.arg(
321321
Arg::new(OPT_HEX_SUFFIXES_SHORT)
@@ -327,7 +327,7 @@ pub fn uu_app() -> Command {
327327
OPT_HEX_SUFFIXES,
328328
OPT_HEX_SUFFIXES_SHORT,
329329
])
330-
.help(translate!("split-help-hex-suffixes-short")),
330+
.help_localized(translate!("split-help-hex-suffixes-short")),
331331
)
332332
.arg(
333333
Arg::new(OPT_HEX_SUFFIXES)
@@ -341,20 +341,20 @@ pub fn uu_app() -> Command {
341341
OPT_HEX_SUFFIXES_SHORT,
342342
])
343343
.value_name("FROM")
344-
.help(translate!("split-help-hex-suffixes")),
344+
.help_localized(translate!("split-help-hex-suffixes")),
345345
)
346346
.arg(
347347
Arg::new(OPT_SUFFIX_LENGTH)
348348
.short('a')
349349
.long(OPT_SUFFIX_LENGTH)
350350
.allow_hyphen_values(true)
351351
.value_name("N")
352-
.help(translate!("split-help-suffix-length")),
352+
.help_localized(translate!("split-help-suffix-length")),
353353
)
354354
.arg(
355355
Arg::new(OPT_VERBOSE)
356356
.long(OPT_VERBOSE)
357-
.help(translate!("split-help-verbose"))
357+
.help_localized(translate!("split-help-verbose"))
358358
.action(ArgAction::SetTrue),
359359
)
360360
.arg(
@@ -364,7 +364,7 @@ pub fn uu_app() -> Command {
364364
.allow_hyphen_values(true)
365365
.value_name("SEP")
366366
.action(ArgAction::Append)
367-
.help(translate!("split-help-separator")),
367+
.help_localized(translate!("split-help-separator")),
368368
)
369369
.arg(
370370
Arg::new(OPT_IO_BLKSIZE)
@@ -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_localized(""),
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_localized(""),
385387
)
388+
.localize_help_and_version()
389+
.localize_help_template()
386390
}
387391

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

0 commit comments

Comments
 (0)