Merge branch 'main' into long_help_file

This commit is contained in:
Sylvestre Ledru
2022-08-20 11:58:37 +02:00
committed by GitHub
114 changed files with 1701 additions and 869 deletions
+2
View File
@@ -849,6 +849,7 @@ jobs:
name: Test Android builds
needs: [ min_version, deps ]
runs-on: macos-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
@@ -904,6 +905,7 @@ jobs:
name: Tests/FreeBSD test suite
needs: [ min_version, deps ]
runs-on: ${{ matrix.job.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
Generated
+325 -216
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -190,6 +190,7 @@ feat_require_unix = [
"nohup",
"pathchk",
"stat",
"stty",
"timeout",
"tty",
"uname",
@@ -261,7 +262,7 @@ uudoc = [ "zip" ]
[dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
clap_complete = "3.1"
once_cell = "1.13.0"
once_cell = "1.13.1"
phf = "0.10.1"
selinux = { version="0.2", optional = true }
textwrap = { version="0.15", features=["terminal_size"] }
@@ -348,6 +349,7 @@ sort = { optional=true, version="0.0.14", package="uu_sort", path="src/uu/so
split = { optional=true, version="0.0.14", package="uu_split", path="src/uu/split" }
stat = { optional=true, version="0.0.14", package="uu_stat", path="src/uu/stat" }
stdbuf = { optional=true, version="0.0.14", package="uu_stdbuf", path="src/uu/stdbuf" }
stty = { optional=true, version="0.0.14", package="uu_stty", path="src/uu/stty" }
sum = { optional=true, version="0.0.14", package="uu_sum", path="src/uu/sum" }
sync = { optional=true, version="0.0.14", package="uu_sync", path="src/uu/sync" }
tac = { optional=true, version="0.0.14", package="uu_tac", path="src/uu/tac" }
@@ -402,7 +404,7 @@ hex-literal = "0.3.1"
rlimit = "0.8.3"
[target.'cfg(unix)'.dev-dependencies]
nix = { version = "0.24.2", default-features = false, features = ["process", "signal", "user"] }
nix = { version = "0.25", default-features = false, features = ["process", "signal", "user"] }
rust-users = { version="0.11", package="users" }
unix_socket = "0.5.0"
+94 -92
View File
@@ -17,6 +17,8 @@
uutils is an attempt at writing universal (as in cross-platform) CLI
utilities in [Rust](http://www.rust-lang.org).
While all programs hve been implemented, some options might be missing
or different behavior might be experienced.
To install it:
@@ -408,98 +410,98 @@ Please note that this is not fully accurate:
See https://github.com/uutils/coreutils/issues/3336 for the main meta bugs
(many are missing).
| Done | WIP | To Do |
|-----------|-----------|--------|
| arch | cp | stty |
| base32 | date | |
| base64 | dd | |
| basename | df | |
| basenc | expr | |
| cat | install | |
| chcon | ls | |
| chgrp | more | |
| chmod | numfmt | |
| chown | od (`--strings` and 128-bit data types missing) | |
| chroot | pr | |
| cksum | printf | |
| comm | sort | |
| csplit | split | |
| cut | tac | |
| dircolors | test | |
| dirname | dir | |
| du | vdir | |
| echo | | |
| env | | |
| expand | | |
| factor | | |
| false | | |
| fmt | | |
| fold | | |
| groups | | |
| hashsum | | |
| head | | |
| hostid | | |
| hostname | | |
| id | | |
| join | | |
| kill | | |
| link | | |
| ln | | |
| logname | | |
| ~~md5sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | | |
| ~~sha1sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | | |
| ~~sha224sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | | |
| ~~sha256sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | | |
| ~~sha384sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | | |
| ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | | |
| mkdir | | |
| mkfifo | | |
| mknod | | |
| mktemp | | |
| mv | | |
| nice | | |
| nl | | |
| nohup | | |
| nproc | | |
| paste | | |
| pathchk | | |
| pinky | | |
| printenv | | |
| ptx | | |
| pwd | | |
| readlink | | |
| realpath | | |
| relpath | | |
| rm | | |
| rmdir | | |
| runcon | | |
| seq | | |
| shred | | |
| shuf | | |
| sleep | | |
| stat | | |
| stdbuf | | |
| sum | | |
| sync | | |
| tail | | |
| tee | | |
| timeout | | |
| touch | | |
| tr | | |
| true | | |
| truncate | | |
| tsort | | |
| tty | | |
| uname | | |
| unexpand | | |
| uniq | | |
| unlink | | |
| uptime | | |
| users | | |
| wc | | |
| who | | |
| whoami | | |
| yes | | |
| Done | WIP |
|-----------|-----------|
| arch | cp |
| base32 | date |
| base64 | dd |
| basename | df |
| basenc | expr |
| cat | install |
| chcon | ls |
| chgrp | more |
| chmod | numfmt |
| chown | od (`--strings` and 128-bit data types missing) |
| chroot | pr |
| cksum | printf |
| comm | sort |
| csplit | split |
| cut | tac |
| dircolors | test |
| dirname | dir |
| du | vdir |
| echo | stty |
| env | |
| expand | |
| factor | |
| false | |
| fmt | |
| fold | |
| groups | |
| hashsum | |
| head | |
| hostid | |
| hostname | |
| id | |
| join | |
| kill | |
| link | |
| ln | |
| logname | |
| ~~md5sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | |
| ~~sha1sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | |
| ~~sha224sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | |
| ~~sha256sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | |
| ~~sha384sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | |
| ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/main/src/uu/hashsum/src/hashsum.rs)) | |
| mkdir | |
| mkfifo | |
| mknod | |
| mktemp | |
| mv | |
| nice | |
| nl | |
| nohup | |
| nproc | |
| paste | |
| pathchk | |
| pinky | |
| printenv | |
| ptx | |
| pwd | |
| readlink | |
| realpath | |
| relpath | |
| rm | |
| rmdir | |
| runcon | |
| seq | |
| shred | |
| shuf | |
| sleep | |
| stat | |
| stdbuf | |
| sum | |
| sync | |
| tail | |
| tee | |
| timeout | |
| touch | |
| tr | |
| true | |
| truncate | |
| tsort | |
| tty | |
| uname | |
| unexpand | |
| uniq | |
| unlink | |
| uptime | |
| users | |
| wc | |
| who | |
| whoami | |
| yes | |
## License
+1 -2
View File
@@ -30,6 +30,7 @@ allow = [
"BSD-3-Clause",
"CC0-1.0",
"MPL-2.0", # XXX considered copyleft?
"Unicode-DFS-2016",
]
copyleft = "deny"
allow-osi-fsf-free = "neither"
@@ -69,8 +70,6 @@ skip = [
{ name = "arrayvec", version = "=0.7.2" },
# flimit/unix_socket
{ name = "cfg-if", version = "=0.1.10" },
# indexmap
{ name = "hashbrown", version = "=0.11.2" },
# kernel32-sys
{ name = "winapi", version = "=0.2.8" },
# bindgen 0.59.2
-1
View File
@@ -1 +0,0 @@
include!("../src/bin/coreutils.rs");
-1
View File
@@ -1 +0,0 @@
include!("../src/bin/coreutils.rs");
+2 -5
View File
@@ -147,22 +147,19 @@ fn gen_completions<T: uucore::Args>(
)
.arg(
Arg::new("shell")
.value_parser(clap::builder::PossibleValuesParser::new(
Shell::possible_values(),
))
.value_parser(clap::builder::EnumValueParser::<Shell>::new())
.required(true),
)
.get_matches_from(std::iter::once(OsString::from("completion")).chain(args));
let utility = matches.value_of("utility").unwrap();
let shell = matches.value_of("shell").unwrap();
let shell = matches.get_one::<Shell>("shell").unwrap().to_owned();
let mut command = if utility == "coreutils" {
gen_coreutils_app(util_map)
} else {
util_map.get(utility).unwrap().1()
};
let shell: Shell = shell.parse().unwrap();
let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + utility;
clap_complete::generate(shell, &mut command, bin_name, &mut io::stdout());
+1 -1
View File
@@ -15,7 +15,7 @@ edition = "2021"
path = "src/arch.rs"
[dependencies]
platform-info = "0.2"
platform-info = "1.0.0"
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
+2 -4
View File
@@ -12,7 +12,7 @@ use std::io::{stdout, Read, Write};
use uucore::display::Quotable;
use uucore::encoding::{wrap_print, Data, Format};
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
use uucore::{format_usage, InvalidEncodingHandling};
use uucore::format_usage;
use std::fs::File;
use std::io::{BufReader, Stdin};
@@ -87,9 +87,7 @@ impl Config {
pub fn parse_base_cmd_args(args: impl uucore::Args, about: &str, usage: &str) -> UResult<Config> {
let command = base_app(about, usage);
let arg_list = args
.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any();
let arg_list = args.collect_lossy();
Config::from(&command.try_get_matches_from(arg_list)?)
}
+2 -4
View File
@@ -11,7 +11,7 @@ use clap::{crate_version, Arg, Command};
use std::path::{is_separator, PathBuf};
use uucore::display::Quotable;
use uucore::error::{UResult, UUsageError};
use uucore::{format_usage, InvalidEncodingHandling};
use uucore::format_usage;
static ABOUT: &str = r#"Print NAME with any leading directory components removed
If specified, also remove a trailing SUFFIX"#;
@@ -28,9 +28,7 @@ pub mod options {
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args
.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any();
let args = args.collect_lossy();
// Since options have to go before names,
// if the first argument is not an option, then there is no option,
+1 -5
View File
@@ -14,7 +14,6 @@ use uu_base32::base_common::{self, Config, BASE_CMD_PARSE_ERROR};
use uucore::{
encoding::Format,
error::{UResult, UUsageError},
InvalidEncodingHandling,
};
use std::io::{stdin, Read};
@@ -52,10 +51,7 @@ pub fn uu_app<'a>() -> Command<'a> {
fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {
let matches = uu_app()
.try_get_matches_from(
args.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any(),
)
.try_get_matches_from(args.collect_lossy())
.with_exit_code(1)?;
let format = ENCODINGS
.iter()
+1 -1
View File
@@ -22,7 +22,7 @@ uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=[
[target.'cfg(unix)'.dependencies]
unix_socket = "0.5.0"
nix = { version = "0.24.2", default-features = false }
nix = { version = "0.25", default-features = false }
[[bin]]
name = "cat"
+2 -4
View File
@@ -36,7 +36,7 @@ use std::net::Shutdown;
use std::os::unix::fs::FileTypeExt;
#[cfg(unix)]
use unix_socket::UnixStream;
use uucore::{format_usage, InvalidEncodingHandling};
use uucore::format_usage;
static NAME: &str = "cat";
static USAGE: &str = "{} [OPTION]... [FILE]...";
@@ -184,9 +184,7 @@ mod options {
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args
.collect_str(InvalidEncodingHandling::Ignore)
.accept_any();
let args = args.collect_ignore();
let matches = uu_app().try_get_matches_from(args)?;
+6 -6
View File
@@ -357,9 +357,9 @@ fn parse_command_line(config: clap::Command, args: impl uucore::Args) -> Result<
// By default, do not preserve root.
let preserve_root = matches.contains_id(options::preserve_root::PRESERVE_ROOT);
let mut files = matches.values_of_os("FILE").unwrap_or_default();
let mut files = matches.get_many::<PathBuf>("FILE").unwrap_or_default();
let mode = if let Some(path) = matches.value_of_os(options::REFERENCE) {
let mode = if let Some(path) = matches.get_one::<OsString>(options::REFERENCE) {
CommandLineMode::ReferenceBased {
reference: PathBuf::from(path),
}
@@ -369,10 +369,10 @@ fn parse_command_line(config: clap::Command, args: impl uucore::Args) -> Result<
|| matches.contains_id(options::RANGE)
{
CommandLineMode::Custom {
user: matches.value_of_os(options::USER).map(Into::into),
role: matches.value_of_os(options::ROLE).map(Into::into),
the_type: matches.value_of_os(options::TYPE).map(Into::into),
range: matches.value_of_os(options::RANGE).map(Into::into),
user: matches.get_one::<OsString>(options::USER).map(Into::into),
role: matches.get_one::<OsString>(options::ROLE).map(Into::into),
the_type: matches.get_one::<OsString>(options::TYPE).map(Into::into),
range: matches.get_one::<OsString>(options::RANGE).map(Into::into),
}
} else if let Some(context) = files.next() {
CommandLineMode::ContextBased {
+1 -1
View File
@@ -16,7 +16,7 @@ path = "src/chmod.rs"
[dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
libc = "0.2.126"
libc = "0.2.132"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode"] }
[[bin]]
+2 -4
View File
@@ -18,7 +18,7 @@ use uucore::fs::is_symlink;
use uucore::libc::mode_t;
#[cfg(not(windows))]
use uucore::mode;
use uucore::{format_usage, show_error, InvalidEncodingHandling};
use uucore::{format_usage, show_error};
static ABOUT: &str = "Change the mode of each FILE to MODE.
With --reference, change the mode of each FILE to that of RFILE.";
@@ -46,9 +46,7 @@ fn get_long_usage() -> String {
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let mut args = args
.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any();
let mut args = args.collect_lossy();
// Before we can parse 'args' with clap (and previously getopts),
// a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE").
+2 -4
View File
@@ -17,7 +17,7 @@ use std::path::Path;
use std::process;
use uucore::error::{set_exit_code, UResult};
use uucore::libc::{self, chroot, setgid, setgroups, setuid};
use uucore::{entries, format_usage, InvalidEncodingHandling};
use uucore::{entries, format_usage};
static ABOUT: &str = "Run COMMAND with root directory set to NEWROOT.";
static USAGE: &str = "{} [OPTION]... NEWROOT [COMMAND [ARG]...]";
@@ -33,9 +33,7 @@ mod options {
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args
.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any();
let args = args.collect_lossy();
let matches = uu_app().get_matches_from(args);
+1 -4
View File
@@ -12,7 +12,6 @@ use std::io::{self, stdin, BufReader, Read};
use std::path::Path;
use uucore::display::Quotable;
use uucore::error::{FromIo, UResult};
use uucore::InvalidEncodingHandling;
use uucore::{format_usage, show};
// NOTE: CRC_TABLE_LEN *must* be <= 256 as we cast 0..CRC_TABLE_LEN to u8
@@ -114,9 +113,7 @@ mod options {
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args
.collect_str(InvalidEncodingHandling::Ignore)
.accept_any();
let args = args.collect_ignore();
let matches = uu_app().get_matches_from(args);
+2 -4
View File
@@ -13,7 +13,7 @@ use std::io::{self, stdin, BufRead, BufReader, Stdin};
use std::path::Path;
use uucore::error::FromIo;
use uucore::error::UResult;
use uucore::{format_usage, InvalidEncodingHandling};
use uucore::format_usage;
use clap::{crate_version, Arg, ArgMatches, Command};
@@ -132,9 +132,7 @@ fn open_file(name: &str) -> io::Result<LineReader> {
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args
.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any();
let args = args.collect_lossy();
let matches = uu_app().get_matches_from(args);
let filename1 = matches.value_of(options::FILE_1).unwrap();

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