Skip to content
Merged
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
10 changes: 9 additions & 1 deletion src/uu/pwd/locales/en-US.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
pwd-about = Display the full filename of the current working directory.
pwd-usage = pwd [OPTION]... [FILE]...
pwd-usage = pwd [OPTION]...

# Help messages
pwd-help-logical = use PWD from environment, even if it contains symlinks
pwd-help-physical = avoid all symlinks

# Error messages
pwd-error-failed-to-get-current-directory = failed to get current directory
pwd-error-failed-to-print-current-directory = failed to print current directory
10 changes: 10 additions & 0 deletions src/uu/pwd/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pwd-about = Afficher le nom de fichier complet du répertoire de travail actuel.
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

# Messages d'erreur
pwd-error-failed-to-get-current-directory = échec de l'obtention du répertoire actuel
pwd-error-failed-to-print-current-directory = échec de l'affichage du répertoire actuel
10 changes: 5 additions & 5 deletions src/uu/pwd/src/pwd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} else {
physical_path()
}
.map_err_context(|| "failed to get current directory".to_owned())?;
.map_err_context(|| get_message("pwd-error-failed-to-get-current-directory"))?;

// \\?\ is a prefix Windows gives to paths under certain circumstances,
// including when canonicalizing them.
Expand All @@ -132,8 +132,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.map(Into::into)
.unwrap_or(cwd);

println_verbatim(cwd).map_err_context(|| "failed to print current directory".to_owned())?;

println_verbatim(cwd)
.map_err_context(|| get_message("pwd-error-failed-to-print-current-directory"))?;
Ok(())
}

Expand All @@ -147,15 +147,15 @@ pub fn uu_app() -> Command {
Arg::new(OPT_LOGICAL)
.short('L')
.long(OPT_LOGICAL)
.help("use PWD from environment, even if it contains symlinks")
.help(get_message("pwd-help-logical"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(OPT_PHYSICAL)
.short('P')
.long(OPT_PHYSICAL)
.overrides_with(OPT_LOGICAL)
.help("avoid all symlinks")
.help(get_message("pwd-help-physical"))
.action(ArgAction::SetTrue),
)
}
6 changes: 3 additions & 3 deletions tests/by-util/test_pwd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn test_deleted_dir() {
let output = Command::new("sh")
.arg("-c")
.arg(format!(
"cd '{}'; mkdir foo; cd foo; rmdir ../foo; exec '{}' {}",
"cd '{}'; mkdir foo; cd foo; rmdir ../foo; LANG=C exec '{}' {}",
at.root_dir_resolved(),
ts.bin_path.to_str().unwrap(),
ts.util_name,
Expand All @@ -48,8 +48,8 @@ fn test_deleted_dir() {
assert!(!output.status.success());
assert!(output.stdout.is_empty());
assert_eq!(
output.stderr,
b"pwd: failed to get current directory: No such file or directory\n"
String::from_utf8_lossy(&output.stderr),
"pwd: failed to get current directory: No such file or directory\n"
);
}

Expand Down
Loading