Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/uu/pwd/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pwd-usage = pwd [OPTION]...
# Help messages
pwd-help-logical = use PWD from environment, even if it contains symlinks
pwd-help-physical = avoid all symlinks
pwd-help-text = Print help information
pwd-version-text = Print version information

# Error messages
pwd-error-failed-to-get-current-directory = failed to get current directory
Expand Down
2 changes: 2 additions & 0 deletions src/uu/pwd/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pwd-usage = pwd [OPTION]...
# Messages d'aide
pwd-help-logical = utiliser PWD de l'environnement, même s'il contient des liens symboliques
pwd-help-physical = éviter tous les liens symboliques
pwd-help-text = Afficher l'aide
pwd-version-text = Afficher les informations de version

# Messages d'erreur
pwd-error-failed-to-get-current-directory = échec de l'obtention du répertoire actuel
Expand Down
16 changes: 16 additions & 0 deletions src/uu/pwd/src/pwd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ pub fn uu_app() -> Command {
.about(translate!("pwd-about"))
.override_usage(format_usage(&translate!("pwd-usage")))
.infer_long_args(true)
.disable_help_flag(true)
.disable_version_flag(true)
.arg(
Arg::new("help")
.short('h')
.long("help")
.help(translate!("pwd-help-text"))
.action(ArgAction::Help),
)
.arg(
Arg::new("version")
.short('V')
.long("version")
.help(translate!("pwd-version-text"))
.action(ArgAction::Version),
)
.arg(
Arg::new(OPT_LOGICAL)
.short('L')
Expand Down
36 changes: 36 additions & 0 deletions tests/by-util/test_pwd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,42 @@ fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
}

#[test]
fn test_help() {
new_ucmd!()
.arg("--help")
.succeeds()
.stdout_contains("Display the full filename of the current working directory")
.stdout_contains("--help")
.stdout_contains("--version");
}

#[test]
fn test_version() {
new_ucmd!()
.arg("--version")
.succeeds()
.stdout_contains("uutils coreutils");
}

#[test]
fn test_short_help() {
new_ucmd!()
.arg("-h")
.succeeds()
.stdout_contains("Display the full filename of the current working directory")
.stdout_contains("-h");
}

#[test]
fn test_short_version() {
new_ucmd!()
.arg("-V")
.succeeds()
.stdout_contains("pwd")
.stdout_contains("uutils coreutils");
}

#[test]
fn test_default() {
let (at, mut ucmd) = at_and_ucmd!();
Expand Down
Loading