1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #2936 from tertsdiepraam/clap-infer-long-args

all: enable infer long arguments in clap
This commit is contained in:
Sylvestre Ledru 2022-01-29 09:57:15 +01:00 committed by GitHub
commit cbc7da3d7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 358 additions and 222 deletions

View file

@ -8,7 +8,7 @@
use platform_info::*;
use clap::{crate_version, App};
use clap::{crate_version, App, AppSettings};
use uucore::error::{FromIo, UResult};
static ABOUT: &str = "Display machine architecture";
@ -28,4 +28,5 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.after_help(SUMMARY)
.setting(AppSettings::InferLongArgs)
}

View file

@ -18,7 +18,7 @@ use std::fs::File;
use std::io::{BufReader, Stdin};
use std::path::Path;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
pub static BASE_CMD_PARSE_ERROR: i32 = 1;
@ -97,6 +97,7 @@ pub fn base_app(about: &str) -> App {
App::new(uucore::util_name())
.version(crate_version!())
.about(about)
.setting(AppSettings::InferLongArgs)
// Format arguments.
.arg(
Arg::new(options::DECODE)

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) fullname
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::path::{is_separator, PathBuf};
use uucore::display::Quotable;
use uucore::error::{UResult, UUsageError};
@ -97,6 +97,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::MULTIPLE)
.short('a')

View file

@ -36,9 +36,6 @@ const ENCODINGS: &[(&str, Format)] = &[
("base2lsbf", Format::Base2Lsbf),
("base2msbf", Format::Base2Msbf),
("z85", Format::Z85),
// common abbreviations. TODO: once we have clap 3.0 we can use `AppSettings::InferLongArgs` to get all abbreviations automatically
("base2l", Format::Base2Lsbf),
("base2m", Format::Base2Msbf),
];
fn usage() -> String {

View file

@ -14,7 +14,7 @@
extern crate unix_socket;
// last synced with: cat (GNU coreutils) 8.13
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::{metadata, File};
use std::io::{self, Read, Write};
use thiserror::Error;
@ -245,6 +245,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.override_usage(SYNTAX)
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::FILE)
.hide(true)

View file

@ -5,7 +5,7 @@
use uucore::error::{UResult, USimpleError, UUsageError};
use uucore::{display::Quotable, show_error, show_warning};
use clap::{App, Arg};
use clap::{App, AppSettings, Arg};
use selinux::{OpaqueSecurityContext, SecurityContext};
use std::borrow::Cow;
@ -164,6 +164,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(VERSION)
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::dereference::DEREFERENCE)
.long(options::dereference::DEREFERENCE)

View file

@ -12,7 +12,7 @@ pub use uucore::entries;
use uucore::error::{FromIo, UResult, USimpleError};
use uucore::perms::{chown_base, options, IfFrom};
use clap::{App, Arg, ArgMatches};
use clap::{App, AppSettings, Arg, ArgMatches};
use std::fs;
use std::os::unix::fs::MetadataExt;
@ -68,6 +68,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(VERSION)
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::verbosity::CHANGES)
.short('c')

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) Chmoder cmode fmode fperm fref ugoa RFILE RFILE's
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs;
use std::os::unix::fs::{MetadataExt, PermissionsExt};
use std::path::Path;
@ -125,6 +125,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::CHANGES)
.long(options::CHANGES)

View file

@ -13,7 +13,7 @@ use uucore::perms::{chown_base, options, IfFrom};
use uucore::error::{FromIo, UResult, USimpleError};
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::fs;
use std::os::unix::fs::MetadataExt;
@ -71,6 +71,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::verbosity::CHANGES)
.short('c')

View file

@ -10,7 +10,7 @@
mod error;
use crate::error::ChrootError;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::ffi::CString;
use std::io::Error;
use std::path::Path;
@ -96,6 +96,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.override_usage(SYNTAX)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::NEWROOT)
.hide(true)

View file

@ -6,7 +6,7 @@
// file that was distributed with this source code.
// spell-checker:ignore (ToDO) fname
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::File;
use std::io::{self, stdin, BufReader, Read};
use std::path::Path;
@ -146,6 +146,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(SUMMARY)
.override_usage(SYNTAX)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::FILE)
.hide(true)

View file

@ -15,7 +15,7 @@ use uucore::error::FromIo;
use uucore::error::UResult;
use uucore::InvalidEncodingHandling;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
static ABOUT: &str = "compare two sorted files line by line";
static LONG_HELP: &str = "";
@ -152,6 +152,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.after_help(LONG_HELP)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::COLUMN_1)
.short('1')

View file

@ -27,7 +27,7 @@ use winapi::um::fileapi::GetFileInformationByHandle;
use std::borrow::Cow;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use filetime::FileTime;
use quick_error::ResultExt;
use std::collections::HashSet;
@ -300,6 +300,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(Arg::new(options::TARGET_DIRECTORY)
.short('t')
.conflicts_with(options::NO_TARGET_DIRECTORY)

View file

@ -12,7 +12,7 @@ use std::{
io::{BufRead, BufWriter, Write},
};
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use regex::Regex;
use uucore::display::Quotable;
use uucore::error::{FromIo, UResult};
@ -757,6 +757,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::SUFFIX_FORMAT)
.short('b')

View file

@ -11,7 +11,7 @@
extern crate uucore;
use bstr::io::BufReadExt;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::File;
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
use std::path::Path;
@ -539,6 +539,7 @@ pub fn uu_app<'a>() -> App<'a> {
.override_usage(SYNTAX)
.about(SUMMARY)
.after_help(LONG_HELP)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::BYTES)
.short('b')

View file

@ -11,7 +11,7 @@
use chrono::{DateTime, FixedOffset, Local, Offset, Utc};
#[cfg(windows)]
use chrono::{Datelike, Timelike};
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
use libc::{clock_settime, timespec, CLOCK_REALTIME};
use std::fs::File;
@ -261,6 +261,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_DATE)
.short('d')

View file

@ -36,7 +36,7 @@ use std::thread;
use std::time;
use byte_unit::Byte;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use gcd::Gcd;
#[cfg(target_os = "linux")]
use signal_hook::consts::signal;
@ -941,6 +941,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::INFILE)
.long(options::INFILE)

View file

@ -12,7 +12,7 @@ use uucore::error::UResult;
use uucore::fsext::statfs_fn;
use uucore::fsext::{read_fs_list, FsUsage, MountInfo};
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use number_prefix::NumberPrefix;
use std::cell::Cell;
@ -425,6 +425,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_ALL)
.short('a')
@ -530,5 +531,4 @@ pub fn uu_app<'a>() -> App<'a> {
.help("limit listing to file systems not of type TYPE"),
)
.arg(Arg::new(OPT_PATHS).multiple_occurrences(true))
.override_help("Filesystem(s) to list")
}

View file

@ -13,7 +13,7 @@ use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader};
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError, UUsageError};
@ -165,6 +165,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(SUMMARY)
.after_help(LONG_HELP)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::BOURNE_SHELL)
.long("sh")

View file

@ -5,7 +5,7 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::path::Path;
use uucore::display::print_verbatim;
use uucore::error::{UResult, UUsageError};
@ -87,6 +87,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.about(ABOUT)
.version(crate_version!())
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::ZERO)
.long(options::ZERO)

View file

@ -10,8 +10,7 @@ extern crate uucore;
use chrono::prelude::DateTime;
use chrono::Local;
use clap::ArgMatches;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::collections::HashSet;
use std::convert::TryFrom;
use std::env;
@ -630,6 +629,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(SUMMARY)
.after_help(LONG_HELP)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::ALL)
.short('a')
@ -644,7 +644,6 @@ pub fn uu_app<'a>() -> App<'a> {
although the apparent size is usually smaller, it may be larger due to holes \
in ('sparse') files, internal fragmentation, indirect blocks, and the like"
)
.alias("app") // The GNU test suite uses this alias
)
.arg(
Arg::new(options::BLOCK_SIZE)
@ -753,7 +752,6 @@ pub fn uu_app<'a>() -> App<'a> {
Arg::new(options::THRESHOLD)
.short('t')
.long(options::THRESHOLD)
.alias("th")
.value_name("SIZE")
.number_of_values(1)
.allow_hyphen_values(true)

View file

@ -6,7 +6,7 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::io::{self, Write};
use std::iter::Peekable;
use std::str::Chars;
@ -134,8 +134,9 @@ pub fn uu_app<'a>() -> App<'a> {
// TrailingVarArg specifies the final positional argument is a VarArg
// and it doesn't attempts the parse any further args.
// Final argument must have multiple(true) or the usage string equivalent.
.setting(clap::AppSettings::TrailingVarArg)
.setting(clap::AppSettings::AllowHyphenValues)
.setting(AppSettings::TrailingVarArg)
.setting(AppSettings::AllowHyphenValues)
.setting(AppSettings::InferLongArgs)
.version(crate_version!())
.about(SUMMARY)
.after_help(AFTER_HELP)

View file

@ -127,6 +127,7 @@ pub fn uu_app<'a>() -> App<'a> {
.override_usage(USAGE)
.after_help(AFTER_HELP)
.setting(AppSettings::AllowExternalSubcommands)
.setting(AppSettings::InferLongArgs)
.arg(Arg::new("ignore-environment")
.short('i')
.long("ignore-environment")

View file

@ -12,7 +12,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use std::str::from_utf8;
@ -184,6 +184,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.after_help(LONG_HELP)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::INITIAL)
.long(options::INITIAL)

View file

@ -5,7 +5,7 @@
//* For the full copyright and license information, please view the LICENSE
//* file that was distributed with this source code.
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use uucore::error::{UResult, USimpleError};
use uucore::InvalidEncodingHandling;
@ -17,6 +17,7 @@ const HELP: &str = "help";
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.setting(AppSettings::InferLongArgs)
.arg(Arg::new(VERSION).long(VERSION))
.arg(Arg::new(HELP).long(HELP))
}

View file

@ -14,7 +14,7 @@ use std::fmt::Write as FmtWrite;
use std::io::{self, stdin, stdout, BufRead, Write};
mod factor;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
pub use factor::*;
use uucore::display::Quotable;
use uucore::error::UResult;
@ -81,5 +81,6 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(Arg::new(options::NUMBER).multiple_occurrences(true))
}

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::cmp;
use std::fs::File;
use std::io::{stdin, stdout, Write};
@ -226,6 +226,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_CROWN_MARGIN)
.short('c')

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDOs) ncount routput
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Read};
use std::path::Path;
@ -69,6 +69,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.override_usage(SYNTAX)
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::BYTES)
.long(options::BYTES)

View file

@ -25,7 +25,7 @@ use uucore::{
error::{UError, UResult},
};
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
mod options {
pub const USERS: &str = "USERNAME";
@ -109,6 +109,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::USERS)
.multiple_occurrences(true)

View file

@ -20,7 +20,7 @@ mod digest;
use self::digest::Digest;
use self::digest::DigestWriter;
use clap::{App, Arg, ArgMatches};
use clap::{App, AppSettings, Arg, ArgMatches};
use hex::ToHex;
use md5::Context as Md5;
use regex::Regex;
@ -343,6 +343,7 @@ pub fn uu_app_common<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about("Compute and check message digests.")
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new("binary")
.short('b')

View file

@ -5,7 +5,7 @@
// spell-checker:ignore (vars) zlines BUFWRITER seekable
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::convert::{TryFrom, TryInto};
use std::ffi::OsString;
use std::io::{self, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write};
@ -47,6 +47,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.override_usage(USAGE)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::BYTES_NAME)
.short('c')

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) gethostid
use clap::{crate_version, App};
use clap::{crate_version, App, AppSettings};
use libc::c_long;
use uucore::error::UResult;
@ -29,6 +29,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.override_usage(SYNTAX)
.setting(AppSettings::InferLongArgs)
}
fn hostid() {

View file

@ -11,7 +11,7 @@ use std::collections::hash_set::HashSet;
use std::net::ToSocketAddrs;
use std::str;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use uucore::error::{FromIo, UResult};
@ -76,6 +76,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_DOMAIN)
.short('d')

View file

@ -39,7 +39,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::ffi::CStr;
use uucore::display::Quotable;
use uucore::entries::{self, Group, Locate, Passwd};
@ -351,6 +351,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::OPT_AUDIT)
.short('A')

View file

@ -12,7 +12,7 @@ mod mode;
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use file_diff::diff;
use filetime::{set_file_times, FileTime};
use uucore::backup_control::{self, BackupMode};
@ -196,6 +196,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
backup_control::arguments::backup()
)

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::cmp::Ordering;
use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, Split, Stdin, Write};
@ -600,6 +600,7 @@ standard output. The default join field is the first, delimited by blanks.
When FILE1 or FILE2 (not both) is -, read standard input.",
)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new("a")
.short('a')

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use libc::{c_int, pid_t};
use std::io::Error;
use uucore::display::Quotable;
@ -82,6 +82,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::LIST)
.short('l')

View file

@ -4,7 +4,7 @@
// *
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::hard_link;
use std::path::Path;
use uucore::display::Quotable;
@ -40,6 +40,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::FILES)
.hide(true)

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use uucore::display::Quotable;
use uucore::error::{UError, UResult};
@ -183,6 +183,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(backup_control::arguments::backup())
.arg(backup_control::arguments::backup_no_args())
// TODO: opts.arg(

View file

@ -12,7 +12,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App};
use clap::{crate_version, App, AppSettings};
use std::ffi::CStr;
use uucore::error::UResult;
use uucore::InvalidEncodingHandling;
@ -59,4 +59,5 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
}

View file

@ -15,7 +15,7 @@ extern crate lazy_static;
mod quoting_style;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use glob::Pattern;
use lscolors::LsColors;
use number_prefix::NumberPrefix;
@ -709,6 +709,7 @@ pub fn uu_app<'a>() -> App<'a> {
the command line, expect that it will ignore files and directories \
whose names start with '.'.",
)
.setting(AppSettings::InferLongArgs)
// Format arguments
.arg(
Arg::new(options::FORMAT)

View file

@ -10,8 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::OsValues;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches, OsValues};
use std::fs;
use std::path::Path;
use uucore::display::Quotable;
@ -114,6 +113,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::MODE)
.short('m')
@ -125,7 +125,6 @@ pub fn uu_app<'a>() -> App<'a> {
Arg::new(options::PARENTS)
.short('p')
.long(options::PARENTS)
.alias("parent")
.help("make parent directories as needed"),
)
.arg(

View file

@ -8,7 +8,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use libc::mkfifo;
use std::ffi::CString;
use uucore::error::{UResult, USimpleError};
@ -75,6 +75,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.override_usage(USAGE)
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::MODE)
.short('m')

View file

@ -9,7 +9,7 @@
use std::ffi::CString;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use libc::{dev_t, mode_t};
use libc::{S_IFBLK, S_IFCHR, S_IFIFO, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR};
@ -149,6 +149,7 @@ pub fn uu_app<'a>() -> App<'a> {
.override_usage(USAGE)
.after_help(LONG_HELP)
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new("mode")
.short('m')

View file

@ -8,7 +8,7 @@
// spell-checker:ignore (paths) GPGHome
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use uucore::display::{println_verbatim, Quotable};
use uucore::error::{FromIo, UError, UResult};
@ -139,6 +139,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_DIRECTORY)
.short('d')

View file

@ -17,7 +17,7 @@ use std::{
#[cfg(all(unix, not(target_os = "fuchsia")))]
extern crate nix;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use crossterm::{
event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
execute, queue,
@ -100,6 +100,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.about("A file perusal filter for CRT viewing.")
.version(crate_version!())
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::SILENT)
.short('d')

View file

@ -13,7 +13,7 @@ mod error;
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::env;
use std::ffi::OsString;
use std::fs;
@ -123,6 +123,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
backup_control::arguments::backup()
)

View file

@ -110,6 +110,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.setting(AppSettings::TrailingVarArg)
.setting(AppSettings::InferLongArgs)
.version(crate_version!())
.arg(
Arg::new(options::ADJUSTMENT)

View file

@ -8,7 +8,7 @@
// spell-checker:ignore (ToDO) corasick memchr
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Read};
use std::iter::repeat;
@ -145,6 +145,7 @@ pub fn uu_app<'a>() -> App<'a> {
.name(NAME)
.version(crate_version!())
.override_usage(USAGE)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::FILE)
.hide(true)

View file

@ -126,6 +126,7 @@ pub fn uu_app<'a>() -> App<'a> {
.multiple_occurrences(true),
)
.setting(AppSettings::TrailingVarArg)
.setting(AppSettings::InferLongArgs)
}
fn replace_fds() -> UResult<()> {

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::env;
use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError};
@ -75,6 +75,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_ALL)
.long(OPT_ALL)

View file

@ -196,6 +196,7 @@ pub fn uu_app<'a>() -> App<'a> {
.about(ABOUT)
.after_help(LONG_HELP)
.setting(AppSettings::AllowNegativeNumbers)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::DELIMITER)
.short('d')

View file

@ -295,7 +295,8 @@ pub fn uu_app<'a>() -> App<'a> {
.setting(
AppSettings::TrailingVarArg |
AppSettings::DontDelimitTrailingValues |
AppSettings::DeriveDisplayOrder
AppSettings::DeriveDisplayOrder |
AppSettings::InferLongArgs
)
.arg(
Arg::new(options::ADDRESS_RADIX)

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) delim
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Read};
use std::iter::repeat;
@ -52,6 +52,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::SERIAL)
.long(options::SERIAL)

View file

@ -8,7 +8,7 @@
// * that was distributed with this source code.
// spell-checker:ignore (ToDO) lstat
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs;
use std::io::{ErrorKind, Write};
use uucore::display::Quotable;
@ -92,6 +92,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::POSIX)
.short('p')

View file

@ -18,7 +18,7 @@ use std::io::BufReader;
use std::fs::File;
use std::os::unix::fs::MetadataExt;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::path::PathBuf;
use uucore::InvalidEncodingHandling;
@ -136,6 +136,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::LONG_FORMAT)
.short('l')

View file

@ -13,7 +13,7 @@ extern crate quick_error;
use chrono::offset::Local;
use chrono::DateTime;
use clap::App;
use clap::{App, AppSettings};
use getopts::Matches;
use getopts::{HasArg, Occur};
use itertools::Itertools;
@ -172,7 +172,7 @@ quick_error! {
}
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
App::new(uucore::util_name()).setting(AppSettings::InferLongArgs)
}
#[uucore_procs::gen_uumain]

View file

@ -7,7 +7,7 @@
/* last synced with: printenv (GNU coreutils) 8.13 */
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::env;
use uucore::error::UResult;
@ -65,6 +65,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_NULL)
.short('0')

View file

@ -2,7 +2,7 @@
// spell-checker:ignore (change!) each's
// spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use uucore::error::{UResult, UUsageError};
use uucore::memo;
use uucore::InvalidEncodingHandling;
@ -297,4 +297,5 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.arg(Arg::new(VERSION).long(VERSION))
.arg(Arg::new(HELP).long(HELP))
.setting(AppSettings::InferLongArgs)
}

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDOs) corasick memchr Roff trunc oset iset
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use regex::Regex;
use std::cmp;
use std::collections::{BTreeSet, HashMap, HashSet};
@ -705,6 +705,7 @@ pub fn uu_app<'a>() -> App<'a> {
.name(NAME)
.version(crate_version!())
.override_usage(BRIEF)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::FILE)
.hide(true)

View file

@ -5,7 +5,7 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::env;
use std::io;
use std::path::PathBuf;
@ -156,6 +156,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_LOGICAL)
.short('L')

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs;
use std::io::{stdout, Write};
use std::path::{Path, PathBuf};
@ -102,6 +102,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_CANONICALIZE)
.short('f')

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::{
io::{stdout, Write},
path::{Path, PathBuf},
@ -78,6 +78,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_QUIET)
.short('q')

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) subpath absto absfrom absbase
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::env;
use std::path::{Path, PathBuf};
use uucore::display::println_verbatim;
@ -86,6 +86,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(Arg::new(options::DIR).short('d').takes_value(true).help(
"If any of FROM and TO is not subpath of DIR, output absolute path instead of relative",
))

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use remove_dir_all::remove_dir_all;
use std::collections::VecDeque;
use std::fs;
@ -149,7 +149,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_FORCE)
.short('f')

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::{read_dir, remove_dir};
use std::io;
use std::path::Path;
@ -179,6 +179,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_IGNORE_FAIL_NON_EMPTY)
.long(OPT_IGNORE_FAIL_NON_EMPTY)

View file

@ -2,7 +2,7 @@
use uucore::error::{UResult, UUsageError};
use clap::{App, Arg};
use clap::{App, AppSettings, Arg};
use selinux::{OpaqueSecurityContext, SecurityClass, SecurityContext};
use std::borrow::Cow;
@ -114,6 +114,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(VERSION)
.about(ABOUT)
.after_help(DESCRIPTION)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::COMPUTE)
.short('c')

View file

@ -147,6 +147,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.setting(AppSettings::TrailingVarArg)
.setting(AppSettings::AllowHyphenValues)
.setting(AppSettings::InferLongArgs)
.version(crate_version!())
.about(ABOUT)
.arg(

View file

@ -8,7 +8,7 @@
// spell-checker:ignore (words) writeback wipesync
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use rand::prelude::SliceRandom;
use rand::Rng;
use std::cell::{Cell, RefCell};
@ -326,6 +326,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.after_help(AFTER_HELP)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::FORCE)
.long(options::FORCE)

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) cmdline evec seps rvec fdata
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use rand::Rng;
use std::fs::File;
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
@ -124,6 +124,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.help_template(TEMPLATE)
.override_usage(USAGE)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::ECHO)
.short('e')

View file

@ -10,7 +10,7 @@ use std::time::Duration;
use uucore::error::{UResult, USimpleError};
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
static ABOUT: &str = "Pause for NUMBER seconds.";
static LONG_HELP: &str = "Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default),
@ -50,6 +50,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.after_help(LONG_HELP)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::NUMBER)
.help("pause for NUMBER seconds")

View file

@ -25,7 +25,7 @@ mod numeric_str_cmp;
mod tmp_dir;
use chunks::LineData;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use custom_str_cmp::custom_str_cmp;
use ext_sort::ext_sort;
use fnv::FnvHasher;
@ -1281,6 +1281,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::modes::SORT)
.long(options::modes::SORT)

View file

@ -11,7 +11,7 @@ mod filenames;
mod platform;
use crate::filenames::FilenameFactory;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::convert::TryFrom;
use std::env;
use std::fs::remove_file;
@ -107,6 +107,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about("Create output files containing consecutive or interleaved sections of input")
.setting(AppSettings::InferLongArgs)
// strategy (mutually exclusive)
.arg(
Arg::new(OPT_BYTES)

View file

@ -16,7 +16,7 @@ use uucore::fsext::{
};
use uucore::libc::mode_t;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::borrow::Cow;
use std::convert::AsRef;
use std::os::unix::fs::{FileTypeExt, MetadataExt};
@ -970,6 +970,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::DEREFERENCE)
.short('L')

View file

@ -197,6 +197,7 @@ pub fn uu_app<'a>() -> App<'a> {
.about(ABOUT)
.after_help(LONG_HELP)
.setting(AppSettings::TrailingVarArg)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::INPUT)
.long(options::INPUT)

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::File;
use std::io::{stdin, Read};
use std::path::Path;
@ -146,6 +146,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.override_usage(USAGE)
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::FILE)
.multiple_occurrences(true)

View file

@ -9,7 +9,7 @@
extern crate libc;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::path::Path;
use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError};
@ -198,6 +198,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::FILE_SYSTEM)
.short('f')

View file

@ -8,7 +8,7 @@
// spell-checker:ignore (ToDO) sbytes slen dlen memmem memmap Mmap mmap SIGBUS
mod error;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use memchr::memmem;
use memmap2::Mmap;
use std::io::{stdin, stdout, BufWriter, Read, Write};
@ -66,6 +66,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.override_usage(USAGE)
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::BEFORE)
.short('b')

View file

@ -22,7 +22,7 @@ mod platform;
use chunks::ReverseChunks;
use lines::lines;
use clap::{App, Arg};
use clap::{App, AppSettings, Arg};
use std::collections::VecDeque;
use std::ffi::OsString;
use std::fmt;
@ -279,6 +279,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.override_usage(USAGE)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::BYTES)
.short('c')

View file

@ -8,7 +8,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use retain_mut::RetainMut;
use std::fs::OpenOptions;
use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write};
@ -64,6 +64,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.about(ABOUT)
.after_help("If a FILE is -, it refers to a file named - .")
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::APPEND)
.long(options::APPEND)

View file

@ -167,6 +167,7 @@ pub fn uu_app<'a>() -> App<'a> {
.multiple_occurrences(true)
)
.setting(AppSettings::TrailingVarArg)
.setting(AppSettings::InferLongArgs)
}
/// Remove pre-existing SIGCHLD handlers that would make waiting for the child's exit code fail.

View file

@ -13,7 +13,7 @@ pub extern crate filetime;
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg, ArgGroup};
use clap::{crate_version, App, AppSettings, Arg, ArgGroup};
use filetime::*;
use std::fs::{self, File};
use std::path::Path;
@ -133,6 +133,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::ACCESS)
.short('a')
@ -176,7 +177,6 @@ pub fn uu_app<'a>() -> App<'a> {
Arg::new(options::sources::REFERENCE)
.short('r')
.long(options::sources::REFERENCE)
.alias("ref") // clapv3
.help("use this file's times instead of the current time")
.value_name("FILE")
.allow_invalid_utf8(true),

View file

@ -11,7 +11,7 @@ mod convert;
mod operation;
mod unicode_table;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use nom::AsBytes;
use operation::{translate_input, Sequence, SqueezeOperation, TranslateOperation};
use std::io::{stdin, stdout, BufReader, BufWriter};
@ -56,7 +56,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.get_matches_from(args);
let delete_flag = matches.is_present(options::DELETE);
let complement_flag = matches.is_present(options::COMPLEMENT) || matches.is_present("C");
let complement_flag = matches.is_present(options::COMPLEMENT);
let squeeze_flag = matches.is_present(options::SQUEEZE);
let truncate_set1_flag = matches.is_present(options::TRUNCATE_SET1);
@ -148,18 +148,15 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::COMPLEMENT)
// .visible_short_alias('C') // TODO: requires clap "3.0.0-beta.2"
.visible_short_alias('C')
.short('c')
.long(options::COMPLEMENT)
.help("use the complement of SET1"),
)
.arg(
Arg::new("C") // work around for `Arg::visible_short_alias`
.short('C')
.help("same as -c"),
)
.arg(
Arg::new(options::DELETE)
.short('d')

View file

@ -5,7 +5,7 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
use clap::App;
use clap::{App, AppSettings};
use uucore::error::UResult;
#[uucore_procs::gen_uumain]
@ -15,5 +15,5 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
App::new(uucore::util_name()).setting(AppSettings::InferLongArgs)
}

View file

@ -6,7 +6,7 @@
// * file that was distributed with this source code.
// spell-checker:ignore (ToDO) RFILE refsize rfilename fsize tsize
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::convert::TryFrom;
use std::fs::{metadata, OpenOptions};
use std::io::ErrorKind;
@ -137,6 +137,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::IO_BLOCKS)
.short('o')

View file

@ -5,7 +5,7 @@
// *
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Read};
@ -98,6 +98,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.override_usage(USAGE)
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(Arg::new(options::FILE).default_value("-").hide(true))
}

View file

@ -9,7 +9,7 @@
// spell-checker:ignore (ToDO) ttyname filedesc
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::ffi::CStr;
use std::io::Write;
use uucore::error::{UResult, UUsageError};
@ -75,6 +75,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::SILENT)
.long(options::SILENT)

View file

@ -10,7 +10,7 @@
// spell-checker:ignore (ToDO) nodename kernelname kernelrelease kernelversion sysname hwplatform mnrsv
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use platform_info::*;
use uucore::error::{FromIo, UResult};
@ -122,6 +122,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(Arg::new(options::ALL)
.short('a')
.long(options::ALL)

View file

@ -11,7 +11,7 @@
#[macro_use]
extern crate uucore;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write};
use std::str::from_utf8;
@ -108,6 +108,7 @@ pub fn uu_app<'a>() -> App<'a> {
.version(crate_version!())
.override_usage(USAGE)
.about(SUMMARY)
.setting(AppSettings::InferLongArgs)
.arg(Arg::new(options::FILE).hide(true).multiple_occurrences(true))
.arg(
Arg::new(options::ALL)

View file

@ -5,7 +5,7 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::fs::File;
use std::io::{self, stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use std::path::Path;
@ -303,6 +303,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::ALL_REPEATED)
.short('D')

View file

@ -10,7 +10,7 @@
use std::fs::remove_file;
use std::path::Path;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use uucore::display::Quotable;
use uucore::error::{FromIo, UResult};
@ -31,6 +31,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(OPT_PATH)
.required(true)

View file

@ -9,7 +9,7 @@
// spell-checker:ignore (ToDO) getloadavg upsecs updays nusers loadavg boottime uphours upmins
use chrono::{Local, TimeZone, Utc};
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
// import crate time from utmpx
pub use uucore::libc;
@ -66,6 +66,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::SINCE)
.short('s')

View file

@ -10,7 +10,7 @@
use std::path::Path;
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use uucore::error::UResult;
use uucore::utmpx::{self, Utmpx};
@ -68,5 +68,6 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(Arg::new(ARG_FILES).takes_value(true).max_values(1))
}

View file

@ -17,7 +17,7 @@ use unicode_width::UnicodeWidthChar;
use utf8::{BufReadDecoder, BufReadDecoderError};
use word_count::{TitledWordCount, WordCount};
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::cmp::max;
use std::fs::{self, File};
@ -166,6 +166,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::BYTES)
.short('c')

View file

@ -12,7 +12,7 @@ use uucore::error::{FromIo, UResult};
use uucore::libc::{ttyname, STDIN_FILENO, S_IWGRP};
use uucore::utmpx::{self, time, Utmpx};
use clap::{crate_version, App, Arg};
use clap::{crate_version, App, AppSettings, Arg};
use std::borrow::Cow;
use std::ffi::CStr;
use std::os::unix::fs::MetadataExt;
@ -165,6 +165,7 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
.arg(
Arg::new(options::ALL)
.long(options::ALL)

View file

@ -10,7 +10,7 @@
#[macro_use]
extern crate clap;
use clap::App;
use clap::{App, AppSettings};
use uucore::display::println_verbatim;
use uucore::error::{FromIo, UResult};
@ -31,4 +31,5 @@ pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.setting(AppSettings::InferLongArgs)
}

View file

@ -13,7 +13,7 @@ use std::io::{self, Write};
#[macro_use]
extern crate clap;
use clap::{App, Arg};
use clap::{App, AppSettings, Arg};
use uucore::error::{UResult, USimpleError};
#[cfg(any(target_os = "linux", target_os = "android"))]
@ -47,7 +47,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
pub fn uu_app<'a>() -> App<'a> {
app_from_crate!().arg(Arg::new("STRING").index(1).multiple_occurrences(true))
app_from_crate!()
.arg(Arg::new("STRING").index(1).multiple_occurrences(true))
.setting(AppSettings::InferLongArgs)
}
fn prepare_buffer<'a>(input: &'a str, buffer: &'a mut [u8; BUF_SIZE]) -> &'a [u8] {

View file

@ -34,7 +34,7 @@ fn test_base32_encode_file() {
#[test]
fn test_decode() {
for decode_param in &["-d", "--decode"] {
for decode_param in &["-d", "--decode", "--dec"] {
let input = "JBSWY3DPFQQFO33SNRSCC===\n"; // spell-checker:disable-line
new_ucmd!()
.arg(decode_param)
@ -56,7 +56,7 @@ fn test_garbage() {
#[test]
fn test_ignore_garbage() {
for ignore_garbage_param in &["-i", "--ignore-garbage"] {
for ignore_garbage_param in &["-i", "--ignore-garbage", "--ig"] {
let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n"; // spell-checker:disable-line
new_ucmd!()
.arg("-d")
@ -69,7 +69,7 @@ fn test_ignore_garbage() {
#[test]
fn test_wrap() {
for wrap_param in &["-w", "--wrap"] {
for wrap_param in &["-w", "--wrap", "--wr"] {
let input = "The quick brown fox jumps over the lazy dog.";
new_ucmd!()
.arg(wrap_param)

View file

@ -26,7 +26,7 @@ fn test_base64_encode_file() {
#[test]
fn test_decode() {
for decode_param in &["-d", "--decode"] {
for decode_param in &["-d", "--decode", "--dec"] {
let input = "aGVsbG8sIHdvcmxkIQ=="; // spell-checker:disable-line
new_ucmd!()
.arg(decode_param)
@ -48,7 +48,7 @@ fn test_garbage() {
#[test]
fn test_ignore_garbage() {
for ignore_garbage_param in &["-i", "--ignore-garbage"] {
for ignore_garbage_param in &["-i", "--ignore-garbage", "--ig"] {
let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
new_ucmd!()
.arg("-d")
@ -61,7 +61,7 @@ fn test_ignore_garbage() {
#[test]
fn test_wrap() {
for wrap_param in &["-w", "--wrap"] {
for wrap_param in &["-w", "--wrap", "--wr"] {
let input = "The quick brown fox jumps over the lazy dog.";
new_ucmd!()
.arg(wrap_param)

View file

@ -61,7 +61,7 @@ fn test_do_not_remove_suffix() {
#[test]
fn test_multiple_param() {
for &multiple_param in &["-a", "--multiple"] {
for &multiple_param in &["-a", "--multiple", "--mul"] {
let path = "/foo/bar/baz";
new_ucmd!()
.args(&[multiple_param, path, path])
@ -72,7 +72,7 @@ fn test_multiple_param() {
#[test]
fn test_suffix_param() {
for &suffix_param in &["-s", "--suffix"] {
for &suffix_param in &["-s", "--suffix", "--suf"] {
let path = "/foo/bar/baz.exe";
new_ucmd!()
.args(&[suffix_param, ".exe", path, path])
@ -83,7 +83,7 @@ fn test_suffix_param() {
#[test]
fn test_zero_param() {
for &zero_param in &["-z", "--zero"] {
for &zero_param in &["-z", "--zero", "--ze"] {
let path = "/foo/bar/baz";
new_ucmd!()
.args(&[zero_param, "-a", path, path])

Some files were not shown because too many files have changed in this diff Show more