1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

Merge pull request #6516 from Its-Just-Nans/documention-functions

documents functions - #5069
This commit is contained in:
Sylvestre Ledru 2024-07-01 23:57:32 +02:00 committed by GitHub
commit 63250a6aa1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -139,10 +139,14 @@ pub fn format_usage(s: &str) -> String {
s.replace("{}", crate::execution_phrase()) 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 <utility>`)
pub fn get_utility_is_second_arg() -> bool { pub fn get_utility_is_second_arg() -> bool {
crate::macros::UTILITY_IS_SECOND_ARG.load(Ordering::SeqCst) 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() { pub fn set_utility_is_second_arg() {
crate::macros::UTILITY_IS_SECOND_ARG.store(true, Ordering::SeqCst); crate::macros::UTILITY_IS_SECOND_ARG.store(true, Ordering::SeqCst);
} }
@ -199,6 +203,8 @@ pub trait Args: Iterator<Item = OsString> + Sized {
impl<T: Iterator<Item = OsString> + Sized> Args for T {} impl<T: Iterator<Item = OsString> + 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<Item = OsString> { pub fn args_os() -> impl Iterator<Item = OsString> {
ARGV.iter().cloned() ARGV.iter().cloned()
} }