Skip to content

Conversation

@fox0
Copy link
Contributor

@fox0 fox0 commented Oct 15, 2024

Current status:

$ LANG= target/debug/time --help time - time a simple command or give resource usage Usage: time [OPTIONS] <UTILITY> [ARGUMENT]... Arguments: <UTILITY> The utility to be invoked [ARGUMENT]... Arguments for the utility Options: -p, --posix Write timing output to standard error in POSIX format -h, --help Print help -V, --version Print version 
$ LANG="ru_RU.UTF-8" target/debug/time --help time - время выполнения простой команды или получение подсказки по ресурсу Использование: time [OPTIONS] <UTILITY> [ARGUMENT]... Аргументы: <UTILITY> Команда для запуска [ARGUMENT]... Аргументы для передаче команде Параметры: -p, --posix При локали POSIX использовать точный традиционный формат -h, --help Показать эту справку и выйти -V, --version Показать информацию о версии и выйти 

Unresolved issues:

$ LANG="ru_RU.UTF-8" target/debug/time --exists error: unexpected argument '--exists' found tip: to pass '--exists' as a value, use '-- --exists' Usage: time [OPTIONS] <UTILITY> [ARGUMENT]... For more information, try '--help'. 
@jgarzik jgarzik added the enhancement New feature or request label Oct 17, 2024
}

#[test]
fn test_smoke_help() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a test that will break every time the command line usage is updated? "fragile" test is sub-optimal.

datetime/time.rs Outdated
about = gettext("time - time a simple command or give resource usage"),
help_template = gettext("{about-with-newline}\nUsage: {usage}\n\nArguments:\n{positionals}\n\nOptions:\n{options}")
help_template = gettext("{about}\n\nUsage: {usage}\n\nArguments:\n{positionals}\n\nOptions:\n{options}"),
version = env!("CARGO_PKG_VERSION"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. is this version = setting required of all posixutils utilities? Surely the default value is correct and wanted?

  2. is a help template for each posixutils utility required, in order to support translation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. No. Fixed.
  2. Yes, but the help template may differ
help_template = gettext("{about-with-newline}\nUsage: {usage}\n\nArguments:\n{positionals}\n\nOptions:\n{options}")
help_template = gettext("{about}\n\nUsage: {usage}\n\nArguments:\n{positionals}\n\nOptions:\n{options}"),
disable_help_flag = true,
disable_version_flag = true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why disable? Is this necessary for gettext-rs to translate the "Print help" string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is disappointing to replicate this across many utilities :(. Oh well; what must be done must be done. We want complete translation support.

@jgarzik jgarzik merged commit 3509eb9 into rustcoreutils:main Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

2 participants