mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge branch 'main' into dependabot/cargo/strum_macros-0.24.1
This commit is contained in:
commit
a07f331665
4 changed files with 32 additions and 7 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1859,9 +1859,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strum"
|
name = "strum"
|
||||||
version = "0.24.0"
|
version = "0.24.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e96acfc1b70604b8b2f1ffa4c57e59176c7dbb05d556c71ecd2f5498a1dee7f8"
|
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strum_macros"
|
name = "strum_macros"
|
||||||
|
|
|
@ -569,10 +569,20 @@ impl Config {
|
||||||
};
|
};
|
||||||
|
|
||||||
let width = match options.value_of(options::WIDTH) {
|
let width = match options.value_of(options::WIDTH) {
|
||||||
Some(x) => match x.parse::<u16>() {
|
Some(x) => {
|
||||||
Ok(u) => u,
|
if x.starts_with('0') && x.len() > 1 {
|
||||||
Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
|
// Read number as octal
|
||||||
},
|
match u16::from_str_radix(x, 8) {
|
||||||
|
Ok(v) => v,
|
||||||
|
Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
match x.parse::<u16>() {
|
||||||
|
Ok(u) => u,
|
||||||
|
Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
None => match termsize::get() {
|
None => match termsize::get() {
|
||||||
Some(size) => size.cols,
|
Some(size) => size.cols,
|
||||||
None => match std::env::var_os("COLUMNS") {
|
None => match std::env::var_os("COLUMNS") {
|
||||||
|
|
|
@ -16,7 +16,7 @@ path = "src/uniq.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
|
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
|
||||||
strum = "0.24.0"
|
strum = "0.24.1"
|
||||||
strum_macros = "0.24.1"
|
strum_macros = "0.24.1"
|
||||||
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
|
||||||
|
|
||||||
|
|
|
@ -650,6 +650,21 @@ fn test_ls_width() {
|
||||||
.stdout_only("test-width-1 test-width-2 test-width-3 test-width-4\n");
|
.stdout_only("test-width-1 test-width-2 test-width-3 test-width-4\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for option in [
|
||||||
|
"-w 062",
|
||||||
|
"-w=062",
|
||||||
|
"--width=062",
|
||||||
|
"--width 062",
|
||||||
|
"--wid=062",
|
||||||
|
] {
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.args(&option.split(' ').collect::<Vec<_>>())
|
||||||
|
.arg("-C")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_only("test-width-1 test-width-3\ntest-width-2 test-width-4\n");
|
||||||
|
}
|
||||||
|
|
||||||
scene
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg("-w=bad")
|
.arg("-w=bad")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue