mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Merge branch 'main' into truncate-no-such-dir
This commit is contained in:
commit
57ee6b5302
114 changed files with 424 additions and 246 deletions
|
@ -250,7 +250,7 @@ clap_complete = "3.0"
|
|||
lazy_static = { version="1.3" }
|
||||
textwrap = { version="0.14", features=["terminal_size"] }
|
||||
uucore = { version=">=0.0.11", package="uucore", path="src/uucore" }
|
||||
selinux = { version="0.2.3", optional = true }
|
||||
selinux = { version="0.2", optional = true }
|
||||
# * uutils
|
||||
uu_test = { optional=true, version="0.0.12", package="uu_test", path="src/uu/test" }
|
||||
#
|
||||
|
|
41
README.md
41
README.md
|
@ -15,27 +15,30 @@
|
|||
<!-- spell-checker:ignore markdownlint ; (options) DESTDIR RUNTEST UTILNAME -->
|
||||
|
||||
uutils is an attempt at writing universal (as in cross-platform) CLI
|
||||
utilities in [Rust](http://www.rust-lang.org). This repository is intended to
|
||||
aggregate GNU coreutils rewrites.
|
||||
utilities in [Rust](http://www.rust-lang.org).
|
||||
|
||||
## Why?
|
||||
|
||||
Many GNU, Linux and other utilities are useful, and obviously
|
||||
[some](http://gnuwin32.sourceforge.net) [effort](http://unxutils.sourceforge.net)
|
||||
has been spent in the past to port them to Windows. However, those projects
|
||||
are written in platform-specific C, a language considered unsafe compared to Rust, and
|
||||
have other issues.
|
||||
uutils aims to work on as many platforms as possible, to be able to use the
|
||||
same utils on Linux, Mac, Windows and other platforms. This ensures, for
|
||||
example, that scripts can be easily transferred between platforms. Rust was
|
||||
chosen not only because it is fast and safe, but is also excellent for
|
||||
writing cross-platform code.
|
||||
|
||||
Rust provides a good, platform-agnostic way of writing systems utilities that are easy
|
||||
to compile anywhere, and this is as good a way as any to try and learn it.
|
||||
## Documentation
|
||||
uutils has both user and developer documentation available:
|
||||
|
||||
- [User Manual](https://uutils.github.io/coreutils-docs/user/)
|
||||
- [Developer Documentation](https://uutils.github.io/coreutils-docs/dev/)
|
||||
|
||||
Both can also be generated locally, the instructions for that can be found in the
|
||||
[coreutils docs](https://github.com/uutils/coreutils-docs) repository.
|
||||
|
||||
<!-- ANCHOR: installation (this mark is needed for mdbook) -->
|
||||
## Requirements
|
||||
|
||||
* Rust (`cargo`, `rustc`)
|
||||
* GNU Make (required to build documentation)
|
||||
* [Sphinx](http://www.sphinx-doc.org/) (for documentation)
|
||||
* gzip (for installing documentation)
|
||||
* GNU Make (optional)
|
||||
|
||||
### Rust Version
|
||||
|
||||
|
@ -44,7 +47,7 @@ The current oldest supported version of the Rust compiler is `1.54`.
|
|||
|
||||
On both Windows and Redox, only the nightly version is tested currently.
|
||||
|
||||
## Build Instructions
|
||||
## Building
|
||||
|
||||
There are currently two methods to build the uutils binaries: either Cargo
|
||||
or GNU Make.
|
||||
|
@ -123,7 +126,7 @@ To build only a few of the available utilities:
|
|||
$ make UTILS='UTILITY_1 UTILITY_2'
|
||||
```
|
||||
|
||||
## Installation Instructions
|
||||
## Installation
|
||||
|
||||
### Cargo
|
||||
|
||||
|
@ -213,7 +216,7 @@ run:
|
|||
cargo run completion ls bash > /usr/local/share/bash-completion/completions/ls
|
||||
```
|
||||
|
||||
## Un-installation Instructions
|
||||
## Un-installation
|
||||
|
||||
Un-installation differs depending on how you have installed uutils. If you used
|
||||
Cargo to install, use Cargo to uninstall. If you used GNU Make to install, use
|
||||
|
@ -255,7 +258,7 @@ $ make PREFIX=/my/path uninstall
|
|||
```
|
||||
<!-- ANCHOR_END: installation (this mark is needed for mdbook) -->
|
||||
|
||||
## Test Instructions
|
||||
## Testing
|
||||
|
||||
Testing can be done using either Cargo or `make`.
|
||||
|
||||
|
@ -321,7 +324,7 @@ To include tests for unimplemented behavior:
|
|||
$ make UTILS='UTILITY_1 UTILITY_2' SPEC=y test
|
||||
```
|
||||
|
||||
## Run Busybox Tests
|
||||
### Run Busybox Tests
|
||||
|
||||
This testing functionality is only available on *nix operating systems and
|
||||
requires `make`.
|
||||
|
@ -344,7 +347,7 @@ To pass an argument like "-v" to the busybox test runtime
|
|||
$ make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytest
|
||||
```
|
||||
|
||||
## Comparing with GNU
|
||||
### Comparing with GNU
|
||||
|
||||

|
||||
|
||||
|
@ -359,7 +362,7 @@ $ bash util/run-gnu-test.sh tests/touch/not-owner.sh # for example
|
|||
|
||||
Note that it relies on individual utilities (not the multicall binary).
|
||||
|
||||
## Contribute
|
||||
## Contributing
|
||||
|
||||
To contribute to uutils, please see [CONTRIBUTING](CONTRIBUTING.md).
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -23,7 +23,7 @@ clap = { version = "3.0", features = ["wrap_help", "cargo"] }
|
|||
filetime = "0.2"
|
||||
libc = "0.2.85"
|
||||
quick-error = "1.2.3"
|
||||
selinux = { version="0.2.3", optional=true }
|
||||
selinux = { version="0.2", optional=true }
|
||||
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms", "mode"] }
|
||||
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
|
||||
walkdir = "2.2"
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
1
src/uu/env/src/env.rs
vendored
1
src/uu/env/src/env.rs
vendored
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -18,7 +18,7 @@ path = "src/id.rs"
|
|||
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
|
||||
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "process"] }
|
||||
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
|
||||
selinux = { version="0.2.1", optional = true }
|
||||
selinux = { version="0.2", optional = true }
|
||||
|
||||
[[bin]]
|
||||
name = "id"
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore", featu
|
|||
uucore_procs = { version=">=0.0.8", package = "uucore_procs", path = "../../uucore_procs" }
|
||||
once_cell = "1.7.2"
|
||||
atty = "0.2"
|
||||
selinux = { version="0.2.1", optional = true }
|
||||
selinux = { version="0.2", optional = true }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
lazy_static = "1.4.0"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -126,6 +126,7 @@ pub fn uu_app<'a>() -> App<'a> {
|
|||
.multiple_occurrences(true),
|
||||
)
|
||||
.setting(AppSettings::TrailingVarArg)
|
||||
.setting(AppSettings::InferLongArgs)
|
||||
}
|
||||
|
||||
fn replace_fds() -> UResult<()> {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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",
|
||||
))
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -31,18 +31,38 @@ impl TruncateMode {
|
|||
///
|
||||
/// `fsize` is the size of the reference file, in bytes.
|
||||
///
|
||||
/// If the mode is [`TruncateMode::Reduce`] and the value to
|
||||
/// reduce by is greater than `fsize`, then this function returns
|
||||
/// 0 (since it cannot return a negative number).
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Extending a file of 10 bytes by 5 bytes:
|
||||
///
|
||||
/// ```rust,ignore
|
||||
/// let mode = TruncateMode::Extend(5);
|
||||
/// let fsize = 10;
|
||||
/// assert_eq!(mode.to_size(fsize), 15);
|
||||
/// ```
|
||||
///
|
||||
/// Reducing a file by more than its size results in 0:
|
||||
///
|
||||
/// ```rust,ignore
|
||||
/// let mode = TruncateMode::Reduce(5);
|
||||
/// let fsize = 3;
|
||||
/// assert_eq!(mode.to_size(fsize), 0);
|
||||
/// ```
|
||||
fn to_size(&self, fsize: usize) -> usize {
|
||||
match self {
|
||||
TruncateMode::Absolute(size) => *size,
|
||||
TruncateMode::Extend(size) => fsize + size,
|
||||
TruncateMode::Reduce(size) => fsize - size,
|
||||
TruncateMode::Reduce(size) => {
|
||||
if *size > fsize {
|
||||
0
|
||||
} else {
|
||||
fsize - size
|
||||
}
|
||||
}
|
||||
TruncateMode::AtMost(size) => fsize.min(*size),
|
||||
TruncateMode::AtLeast(size) => fsize.max(*size),
|
||||
TruncateMode::RoundDown(size) => fsize - fsize % size,
|
||||
|
@ -117,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')
|
||||
|
@ -383,4 +404,11 @@ mod tests {
|
|||
assert_eq!(parse_mode_and_size("/10"), Ok(TruncateMode::RoundDown(10)));
|
||||
assert_eq!(parse_mode_and_size("%10"), Ok(TruncateMode::RoundUp(10)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_size() {
|
||||
assert_eq!(TruncateMode::Extend(5).to_size(10), 15);
|
||||
assert_eq!(TruncateMode::Reduce(5).to_size(10), 5);
|
||||
assert_eq!(TruncateMode::Reduce(5).to_size(3), 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue