diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 366c420d902..cc5b1da71b6 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -139,10 +139,14 @@ pub fn format_usage(s: &str) -> String { s.replace("{}", crate::execution_phrase()) } +/// Used to check if the utility is the second argument. +/// Used to check if we were called as a multicall binary (`coreutils `) pub fn get_utility_is_second_arg() -> bool { crate::macros::UTILITY_IS_SECOND_ARG.load(Ordering::SeqCst) } +/// Change the value of `UTILITY_IS_SECOND_ARG` to true +/// Used to specify that the utility is the second argument. pub fn set_utility_is_second_arg() { crate::macros::UTILITY_IS_SECOND_ARG.store(true, Ordering::SeqCst); } @@ -195,6 +199,8 @@ pub trait Args: Iterator + Sized { impl + Sized> Args for T {} +/// Returns an iterator over the command line arguments as `OsString`s. +/// args_os() can be expensive to call pub fn args_os() -> impl Iterator { ARGV.iter().cloned() }