Skip to content

fmt: Error priorities could be improved #6352

@BenWiederhake

Description

@BenWiederhake
$ 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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions