Attention is currently required from: David Hendricks, Daniel Campello, Angel Pons, Anastasia Klimchuk, Nikolai Artemiev. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/30979 )
Change subject: [RFC] cli_classic: Add `--mode (read|write|verify|erase)` parameter ......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
I believe the main difference between this approach and CB:52362 is that this -m argument is only ne […]
TBH, I'm not very convinced of either version. One downside of the optional argument that I probably didn't repeat lately: Typos in the command line can become more severe (but not as bad as with the non-positional argument). For instance, consider this:
$ flashrom -p prog --ifd -i bios:bios.bin -r
And then you want to add a `-V` but miss the dash, it would still be accepted:
$ flashrom -p prog --ifd -i bios:bios.bin -r V
It's not very bad. IIRC, with the non-positional argument one could do much funnier things.
On the wiki[1], I once came up with this:
[-i <region>]... (-r|-w|-v [<region>:]<filename>)...
I'm not sure anymore, why I implemented `--mode` instead. It seems the classic CLI will grow further anyway. If we'd start with this:
[-i <region>[:<file>]]... -r|-w|-v [<filename>]
We could still later add a (-r|-w|-v [[<region>:]<filename>]) notation. Then we'd stay Cr compatible but nobody would have to use the error-prone optional argument. It would also be easier to have compile-time switches, e.g. to make the file argument optional. If we'd decide to go this way, I'd prefer to have only the latter syntax added to the help text / man page.
What do you think? The idea is rather new to me, I still haven't made up my mind.
[1] https://flashrom.org/Per_region_file_arguments#More_explicit_alternative