+
Skip to content

Conversation

naoNao89
Copy link
Contributor

@naoNao89 naoNao89 commented Oct 11, 2025

This adds -h and -V as short alternatives for --help and --version.

GNU pwd only supports the long forms, but most other uutils accept both.
Having the short flags makes pwd consistent with the rest of the utilities
and more convenient to use.

Changes:

  • Added .short('h') and .short('V') to the help/version args
  • Updated tests to verify both short and long forms work
  • Localization already in place (English & French)

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

naoNao89 added a commit to naoNao89/coreutils that referenced this pull request Oct 11, 2025
Apply feedback from PR uutils#8889 review by @sylvestre:
- English: use 'Print help information' and 'Print version information'
- French: use 'Afficher l'aide' and 'Afficher les informations de version'
- Remove obsolete comment about providing own help/version options
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@memark
Copy link

memark commented Oct 11, 2025

LGTM

@RenjiSann
Copy link
Collaborator

Looking at the GNU pwd source code

Please don't. For licensing reasons, we are not allowed to look at GNU's source code to implement our coreutils.

@sylvestre
Copy link
Contributor

why do you think we should do that ?
i feel that it doesn't bring much to follow GNU here

@naoNao89 naoNao89 marked this pull request as draft October 16, 2025 03:15
@naoNao89
Copy link
Contributor Author

I thought any difference from GNU coreutils was a bug that needed fixing. I now understand uutils aims for compatibility while adding useful extensions when appropriate. I will update this PR to enhance pwd with short flags rather than removing them.

This adds -h and -V as short alternatives for --help and --version.

GNU pwd only supports the long forms, but most other uutils accept both.
Having the short flags makes pwd consistent with the rest of the utilities
and more convenient to use.

Changes:
- Added .short('h') and .short('V') to help/version args
- Updated tests to verify both short and long forms work
- Localization already in place for both English and French
@naoNao89 naoNao89 force-pushed the pwd-help-gnu-compat branch from 3137a1a to 88d47ac Compare October 16, 2025 07:43
@naoNao89 naoNao89 changed the title pwd: make help and version flags long-only for GNU compatibility pwd: add -h/-V short flags for help/version Oct 16, 2025
@cakebaker
Copy link
Contributor

Somehow I don't understand what you try to accomplish with this PR. -h and -V already work in main:

$ cargo run -q pwd -V
pwd (uutils coreutils) 0.3.0
$ cargo run -q pwd -h
Display the full filename of the current working directory.

Usage: pwd [OPTION]...

Options:
  -L, --logical   use PWD from environment, even if it contains symlinks
  -P, --physical  avoid all symlinks
  -h, --help      Print help
  -V, --version   Print version

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@naoNao89
Copy link
Contributor Author

-h/-V already work via Clap defaults. This PR makes them explicit, localizes the help/version lines (en/fr), and adds tests to prevent regressions. No user-visible change, it stabilizes intent and i18n.

@cakebaker
Copy link
Contributor

I think we should do the localization of the help/version lines for all utils in the same place. I opened a ticket for it: #8923

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载