mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
change ~ new_coreopts!()
=> app!()
(from uucore v0.0.4)
This commit is contained in:
parent
4b8fc7445b
commit
ea3235c7e2
32 changed files with 32 additions and 32 deletions
|
@ -17,7 +17,7 @@ static SUMMARY: &str = "Determine architecture name for current machine.";
|
|||
static LONG_HELP: &str = "";
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
app!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
let uts = return_if_err!(1, PlatformInfo::new());
|
||||
println!("{}", uts.machine().trim());
|
||||
0
|
||||
|
|
|
@ -20,7 +20,7 @@ pub fn execute(
|
|||
long_help: &str,
|
||||
format: Format,
|
||||
) -> i32 {
|
||||
let matches = new_coreopts!(syntax, summary, long_help)
|
||||
let matches = app!(syntax, summary, long_help)
|
||||
.optflag("d", "decode", "decode data")
|
||||
.optflag(
|
||||
"i",
|
||||
|
|
|
@ -20,7 +20,7 @@ pub fn execute(
|
|||
long_help: &str,
|
||||
format: Format,
|
||||
) -> i32 {
|
||||
let matches = new_coreopts!(syntax, summary, long_help)
|
||||
let matches = app!(syntax, summary, long_help)
|
||||
.optflag("d", "decode", "decode data")
|
||||
.optflag(
|
||||
"i",
|
||||
|
|
|
@ -20,7 +20,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
//
|
||||
// Argument parsing
|
||||
//
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag(
|
||||
"a",
|
||||
"multiple",
|
||||
|
|
|
@ -123,7 +123,7 @@ enum InputType {
|
|||
type CatResult<T> = Result<T, CatError>;
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag("A", "show-all", "equivalent to -vET")
|
||||
.optflag(
|
||||
"b",
|
||||
|
|
|
@ -35,7 +35,7 @@ const FTS_PHYSICAL: u8 = 1 << 1;
|
|||
const FTS_LOGICAL: u8 = 1 << 2;
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let mut opts = new_coreopts!(SYNTAX, SUMMARY, "");
|
||||
let mut opts = app!(SYNTAX, SUMMARY, "");
|
||||
opts.optflag("c",
|
||||
"changes",
|
||||
"like verbose but report only when a change is made")
|
||||
|
|
|
@ -34,7 +34,7 @@ pub fn uumain(mut args: Vec<String>) -> i32 {
|
|||
{0} [OPTION]... --reference=RFILE FILE...",
|
||||
NAME
|
||||
);
|
||||
let mut opts = new_coreopts!(&syntax, SUMMARY, LONG_HELP);
|
||||
let mut opts = app!(&syntax, SUMMARY, LONG_HELP);
|
||||
opts.optflag(
|
||||
"c",
|
||||
"changes",
|
||||
|
|
|
@ -37,7 +37,7 @@ const FTS_PHYSICAL: u8 = 1 << 1;
|
|||
const FTS_LOGICAL: u8 = 1 << 2;
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let mut opts = new_coreopts!(SYNTAX, SUMMARY, "");
|
||||
let mut opts = app!(SYNTAX, SUMMARY, "");
|
||||
opts.optflag("c",
|
||||
"changes",
|
||||
"like verbose but report only when a change is made")
|
||||
|
|
|
@ -28,7 +28,7 @@ static LONG_HELP: &str = "
|
|||
";
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optopt(
|
||||
"u",
|
||||
"user",
|
||||
|
|
|
@ -70,7 +70,7 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
|
||||
let files = matches.free;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ fn open_file(name: &str) -> io::Result<LineReader> {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag("1", "", "suppress column 1 (lines uniq to FILE1)")
|
||||
.optflag("2", "", "suppress column 2 (lines uniq to FILE2)")
|
||||
.optflag(
|
||||
|
|
|
@ -422,7 +422,7 @@ fn cut_files(mut filenames: Vec<String>, mode: Mode) -> i32 {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optopt("b", "bytes", "filter byte columns from the input source", "sequence")
|
||||
.optopt("c", "characters", "alias for character mode", "sequence")
|
||||
.optopt("d", "delimiter", "specify the delimiter character that separates fields in the input source. Defaults to Tab.", "delimiter")
|
||||
|
|
|
@ -53,7 +53,7 @@ pub fn guess_syntax() -> OutputFmt {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag("b", "sh", "output Bourne shell code to set LS_COLORS")
|
||||
.optflag(
|
||||
"",
|
||||
|
|
|
@ -20,7 +20,7 @@ static LONG_HELP: &str = "
|
|||
";
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag("z", "zero", "separate output with NUL rather than newline")
|
||||
.parse(args);
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
{0} [OPTION]... --files0-from=F",
|
||||
NAME
|
||||
);
|
||||
let matches = new_coreopts!(&syntax, SUMMARY, LONG_HELP)
|
||||
let matches = app!(&syntax, SUMMARY, LONG_HELP)
|
||||
// In task
|
||||
.optflag(
|
||||
"a",
|
||||
|
|
|
@ -103,7 +103,7 @@ fn print_escaped(input: &str, mut output: impl Write) -> io::Result<bool> {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, HELP)
|
||||
.optflag("n", "", "do not output the trailing newline")
|
||||
.optflag("e", "", "enable interpretation of backslash escapes")
|
||||
.optflag(
|
||||
|
|
|
@ -99,7 +99,7 @@ impl Options {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag("i", "initial", "do not convert tabs after non blanks")
|
||||
.optopt(
|
||||
"t",
|
||||
|
|
|
@ -116,7 +116,7 @@ fn print_factors_str(num_str: &str) {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
|
||||
if matches.free.is_empty() {
|
||||
let stdin = stdin();
|
||||
|
|
|
@ -56,7 +56,7 @@ pub struct FmtOptions {
|
|||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag("c", "crown-margin", "First and second line of paragraph may have different indentations, in which case the first line's indentation is preserved, and each subsequent line's indentation matches the second line.")
|
||||
.optflag("t", "tagged-paragraph", "Like -c, except that the first and second line of a paragraph *must* have different indentation or they are treated as separate paragraphs.")
|
||||
.optflag("m", "preserve-headers", "Attempt to detect and preserve mail headers in the input. Be careful when combining this flag with -p.")
|
||||
|
|
|
@ -19,7 +19,7 @@ static LONG_HELP: &str = "";
|
|||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let (args, obs_width) = handle_obsolete(&args[..]);
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optflag(
|
||||
"b",
|
||||
"bytes",
|
||||
|
|
|
@ -14,7 +14,7 @@ static SYNTAX: &str = "[user]";
|
|||
static SUMMARY: &str = "display current group names";
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, "").parse(args);
|
||||
let matches = app!(SYNTAX, SUMMARY, "").parse(args);
|
||||
|
||||
if matches.free.is_empty() {
|
||||
println!(
|
||||
|
|
|
@ -52,7 +52,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
(args, None) => args,
|
||||
};
|
||||
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optopt(
|
||||
"c",
|
||||
"bytes",
|
||||
|
|
|
@ -22,7 +22,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
app!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
hostid();
|
||||
0
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ static SYNTAX: &str = "[OPTION]... [USER]";
|
|||
static SUMMARY: &str = "Print user and group information for the specified USER,\n or (when USER omitted) for the current user.";
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let mut opts = new_coreopts!(SYNTAX, SUMMARY, "");
|
||||
let mut opts = app!(SYNTAX, SUMMARY, "");
|
||||
opts.optflag(
|
||||
"A",
|
||||
"",
|
||||
|
|
|
@ -96,7 +96,7 @@ fn parse_opts(args: Vec<String>) -> getopts::Matches {
|
|||
{} SOURCE... DIRECTORY",
|
||||
NAME
|
||||
);
|
||||
new_coreopts!(&syntax, SUMMARY, LONG_HELP)
|
||||
app!(&syntax, SUMMARY, LONG_HELP)
|
||||
// TODO implement flag
|
||||
.optflagopt(
|
||||
"",
|
||||
|
|
|
@ -30,7 +30,7 @@ pub enum Mode {
|
|||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let (args, obs_signal) = handle_obsolete(args);
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP)
|
||||
.optopt("s", "signal", "specify the <signal> to be sent", "SIGNAL")
|
||||
.optflagopt(
|
||||
"l",
|
||||
|
|
|
@ -24,7 +24,7 @@ pub fn normalize_error_message(e: Error) -> String {
|
|||
}
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
if matches.free.len() != 2 {
|
||||
crash!(1, "{}", msg_wrong_number_of_arguments!(2));
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
{0} [OPTION]... -t DIRECTORY TARGET... (4th form)",
|
||||
NAME
|
||||
);
|
||||
let matches = new_coreopts!(&syntax, SUMMARY, LONG_HELP)
|
||||
let matches = app!(&syntax, SUMMARY, LONG_HELP)
|
||||
.optflag(
|
||||
"b",
|
||||
"",
|
||||
|
|
|
@ -35,7 +35,7 @@ static SUMMARY: &str = "Print user's login name";
|
|||
static LONG_HELP: &str = "";
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
app!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
|
||||
exec();
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
{0} [OPTION]... [FILE]...",
|
||||
NAME
|
||||
);
|
||||
let matches = new_coreopts!(&syntax, SUMMARY, LONG_HELP)
|
||||
let matches = app!(&syntax, SUMMARY, LONG_HELP)
|
||||
.optflag("1", "", "list one file per line.")
|
||||
.optflag(
|
||||
"a",
|
||||
|
|
|
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
The utmp file will be {}",
|
||||
utmpx::DEFAULT_FILE
|
||||
);
|
||||
let mut opts = new_coreopts!(SYNTAX, SUMMARY, &long_help);
|
||||
let mut opts = app!(SYNTAX, SUMMARY, &long_help);
|
||||
opts.optflag(
|
||||
"l",
|
||||
"",
|
||||
|
|
|
@ -45,7 +45,7 @@ If ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.
|
|||
";
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let mut opts = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP);
|
||||
let mut opts = app!(SYNTAX, SUMMARY, LONG_HELP);
|
||||
opts.optflag("a", "all", "same as -b -d --login -p -r -t -T -u");
|
||||
opts.optflag("b", "boot", "time of last system boot");
|
||||
opts.optflag("d", "dead", "print dead processes");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue