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

cat: ignore -u flag, just like GNU does

This commit is contained in:
Ben Wiederhake 2024-03-01 12:22:33 +01:00
parent 472b56f0ff
commit cd70d7dec1
2 changed files with 18 additions and 0 deletions

View file

@ -170,6 +170,7 @@ mod options {
pub static SHOW_NONPRINTING_TABS: &str = "t"; pub static SHOW_NONPRINTING_TABS: &str = "t";
pub static SHOW_TABS: &str = "show-tabs"; pub static SHOW_TABS: &str = "show-tabs";
pub static SHOW_NONPRINTING: &str = "show-nonprinting"; pub static SHOW_NONPRINTING: &str = "show-nonprinting";
pub static IGNORED_U: &str = "ignored-u";
} }
#[uucore::main] #[uucore::main]
@ -301,6 +302,12 @@ pub fn uu_app() -> Command {
.help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)") .help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg(
Arg::new(options::IGNORED_U)
.short('u')
.help("(ignored)")
.action(ArgAction::SetTrue),
)
} }
fn cat_handle<R: FdReadable>( fn cat_handle<R: FdReadable>(

View file

@ -612,3 +612,14 @@ fn test_error_loop() {
.fails() .fails()
.stderr_is("cat: 1: Too many levels of symbolic links\n"); .stderr_is("cat: 1: Too many levels of symbolic links\n");
} }
#[test]
fn test_u_ignored() {
for same_param in ["-u", "-uu"] {
new_ucmd!()
.arg(same_param)
.pipe_in("hello")
.succeeds()
.stdout_only("hello");
}
}