diff options
-rw-r--r-- | src/uu/id/src/id.rs | 1 | ||||
-rw-r--r-- | tests/by-util/test_id.rs | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index fe605a33c..e803708bd 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -397,6 +397,7 @@ pub fn uu_app() -> Command { Arg::new(options::OPT_PASSWORD) .short('P') .help("Display the id as a password file entry.") + .conflicts_with(options::OPT_HUMAN_READABLE) .action(ArgAction::SetTrue), ) .arg( diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index e51f3e542..070ed011e 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -461,3 +461,16 @@ fn test_id_no_specified_user_posixly() { } } } + +#[test] +#[cfg(all(unix, not(target_os = "android")))] +fn test_id_pretty_print_password_record() { + // `-p` is BSD only and not supported on GNU's `id`. + // `-P` is our own extension, and not supported by either GNU nor BSD. + // These must conflict, because they both set the output format. + new_ucmd!() + .arg("-p") + .arg("-P") + .fails() + .stderr_contains("the argument '-p' cannot be used with '-P'"); +} |