mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
split: clap 3
This commit is contained in:
parent
b43839a8a8
commit
ecf6f18ab3
2 changed files with 28 additions and 26 deletions
|
@ -15,7 +15,7 @@ edition = "2018"
|
||||||
path = "src/split.rs"
|
path = "src/split.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "2.33", features = ["wrap_help"] }
|
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
|
||||||
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
|
||||||
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let long_usage = get_long_usage();
|
let long_usage = get_long_usage();
|
||||||
|
|
||||||
let matches = uu_app()
|
let matches = uu_app()
|
||||||
.usage(&usage[..])
|
.override_usage(&usage[..])
|
||||||
.after_help(&long_usage[..])
|
.after_help(&long_usage[..])
|
||||||
.get_matches_from(args);
|
.get_matches_from(args);
|
||||||
|
|
||||||
|
@ -101,30 +101,30 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
split(&settings)
|
split(&settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> App<'static, 'static> {
|
pub fn uu_app<'a>() -> App<'a> {
|
||||||
App::new(uucore::util_name())
|
App::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about("Create output files containing consecutive or interleaved sections of input")
|
.about("Create output files containing consecutive or interleaved sections of input")
|
||||||
// strategy (mutually exclusive)
|
// strategy (mutually exclusive)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_BYTES)
|
Arg::new(OPT_BYTES)
|
||||||
.short("b")
|
.short('b')
|
||||||
.long(OPT_BYTES)
|
.long(OPT_BYTES)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("2")
|
.default_value("2")
|
||||||
.help("use suffixes of length N (default 2)"),
|
.help("use suffixes of length N (default 2)"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_LINE_BYTES)
|
Arg::new(OPT_LINE_BYTES)
|
||||||
.short("C")
|
.short('C')
|
||||||
.long(OPT_LINE_BYTES)
|
.long(OPT_LINE_BYTES)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("2")
|
.default_value("2")
|
||||||
.help("put at most SIZE bytes of lines per output file"),
|
.help("put at most SIZE bytes of lines per output file"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_LINES)
|
Arg::new(OPT_LINES)
|
||||||
.short("l")
|
.short('l')
|
||||||
.long(OPT_LINES)
|
.long(OPT_LINES)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("1000")
|
.default_value("1000")
|
||||||
|
@ -132,50 +132,52 @@ pub fn uu_app() -> App<'static, 'static> {
|
||||||
)
|
)
|
||||||
// rest of the arguments
|
// rest of the arguments
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_ADDITIONAL_SUFFIX)
|
Arg::new(OPT_ADDITIONAL_SUFFIX)
|
||||||
.long(OPT_ADDITIONAL_SUFFIX)
|
.long(OPT_ADDITIONAL_SUFFIX)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("")
|
.default_value("")
|
||||||
.help("additional suffix to append to output file names"),
|
.help("additional suffix to append to output file names"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_FILTER)
|
Arg::new(OPT_FILTER)
|
||||||
.long(OPT_FILTER)
|
.long(OPT_FILTER)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("write to shell COMMAND file name is $FILE (Currently not implemented for Windows)"),
|
.help(
|
||||||
|
"write to shell COMMAND file name is $FILE (Currently not implemented for Windows)",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_NUMERIC_SUFFIXES)
|
Arg::new(OPT_NUMERIC_SUFFIXES)
|
||||||
.short("d")
|
.short('d')
|
||||||
.long(OPT_NUMERIC_SUFFIXES)
|
.long(OPT_NUMERIC_SUFFIXES)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("0")
|
.default_missing_value("0")
|
||||||
.help("use numeric suffixes instead of alphabetic"),
|
.help("use numeric suffixes instead of alphabetic"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_SUFFIX_LENGTH)
|
Arg::new(OPT_SUFFIX_LENGTH)
|
||||||
.short("a")
|
.short('a')
|
||||||
.long(OPT_SUFFIX_LENGTH)
|
.long(OPT_SUFFIX_LENGTH)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value(OPT_DEFAULT_SUFFIX_LENGTH)
|
.default_value(OPT_DEFAULT_SUFFIX_LENGTH)
|
||||||
.help("use suffixes of length N (default 2)"),
|
.help("use suffixes of length N (default 2)"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_VERBOSE)
|
Arg::new(OPT_VERBOSE)
|
||||||
.long(OPT_VERBOSE)
|
.long(OPT_VERBOSE)
|
||||||
.help("print a diagnostic just before each output file is opened"),
|
.help("print a diagnostic just before each output file is opened"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(ARG_INPUT)
|
Arg::new(ARG_INPUT)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("-")
|
.default_value("-")
|
||||||
.index(1)
|
.index(1),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(ARG_PREFIX)
|
Arg::new(ARG_PREFIX)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("x")
|
.default_value("x")
|
||||||
.index(2)
|
.index(2),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue