mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
refactor: simplification and name change
This commit is contained in:
parent
6699eaad6c
commit
4f88356035
1 changed files with 5 additions and 15 deletions
|
@ -119,21 +119,11 @@ pub fn set_utility_is_second_arg() {
|
||||||
static ARGV: Lazy<Vec<OsString>> = Lazy::new(|| wild::args_os().collect());
|
static ARGV: Lazy<Vec<OsString>> = Lazy::new(|| wild::args_os().collect());
|
||||||
|
|
||||||
static UTIL_NAME: Lazy<String> = Lazy::new(|| {
|
static UTIL_NAME: Lazy<String> = Lazy::new(|| {
|
||||||
if get_utility_is_second_arg() {
|
let base_index = if get_utility_is_second_arg() { 1 } else { 0 };
|
||||||
let i = match ARGV[1].eq("manpage") {
|
let is_man = if ARGV[base_index].eq("manpage") { 1 } else { 0 };
|
||||||
true => 1,
|
let argv_index = base_index + is_man;
|
||||||
false => 0,
|
|
||||||
};
|
ARGV[argv_index].to_string_lossy().into_owned()
|
||||||
&ARGV[1 + i]
|
|
||||||
} else {
|
|
||||||
let i = match ARGV[0].eq("manpage") {
|
|
||||||
true => 1,
|
|
||||||
false => 0,
|
|
||||||
};
|
|
||||||
&ARGV[i]
|
|
||||||
}
|
|
||||||
.to_string_lossy()
|
|
||||||
.into_owned()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Derive the utility name.
|
/// Derive the utility name.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue