Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt: Error priorities could be improved #6352

Closed
BenWiederhake opened this issue May 4, 2024 · 2 comments · Fixed by #6362
Closed

fmt: Error priorities could be improved #6352

BenWiederhake opened this issue May 4, 2024 · 2 comments · Fixed by #6362
Assignees
Labels

Comments

@BenWiederhake
Copy link
Collaborator

$ fmt -g apple -g7 tests/fixtures/fmt/one-word-per-line.txt
this is a
file with one
word per line
$ fmt -g apple -g7 -w banana tests/fixtures/fmt/one-word-per-line.txt
fmt: invalid width: 'banana'
[$? = 1]
$ fmt -g apple -w banana tests/fixtures/fmt/one-word-per-line.txt
fmt: invalid width: 'banana'
[$? = 1]
$ fmt -w apple -g banana tests/fixtures/fmt/one-word-per-line.txt
fmt: invalid width: 'apple'
[$? = 1]

This means:

  • A non-numeric value for a numeric argument is okay IF it is later overridden by a numeric argument.
  • --width-related errors take priority over --goal-related errors, no matter the order.

I have some questions:

  • To what extent do we want to be error-message compatible?
  • This probably affects other utils, too. What's our standpoint, in general?
@tertsdiepraam
Copy link
Member

"Terrible" is not support helpful 😄 Do you mean GNU or uutils here? We could do this quite easily, by supporting a string and then passing them after argument parsing.

@sylvestre sylvestre changed the title fmt: Error priorities are terrible fmt: Error priorities could be improved May 5, 2024
@BenWiederhake
Copy link
Collaborator Author

Oh, sorry! I meant GNU, as in "This is terribly difficult to match".

re parsing: Oh! I only now notice that the error message is indeed simple enough. Dips!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants