mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #2936 from tertsdiepraam/clap-infer-long-args
all: enable infer long arguments in clap
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
+2
-1
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
+2
-1
@@ -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)
|
||||
|
||||
+2
-2
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user