Repository navigation
Enable key=value long options in OPT - #23
Conversation
pfusik
left a comment
There was a problem hiding this comment.
We don't have to provide long aliases to all the short options right away. The long options should serve future expansions not 1:1 mapping of short options.
The obvious ones are listing=on, listing=off, cpu=65c02, cpu=6502.
|
|
||
| void setNamedOption(string name, bool hasValue, string value) { | ||
| switch (name) { | ||
| case "FILL": |
There was a problem hiding this comment.
How about combining three short options into one long:
opt o- = opt 'output=off'
opt o+h-f- = opt 'output=raw'
opt o+h-f+ = opt 'output=rom'
opt o+h+f- = opt 'output=ataridos' ; default
opt o+h+f+ ; not useful, no long alias
There was a problem hiding this comment.
Looks good. I'd add a few restrictions:
- setting
outputis an error after anything has been emitted to object, - setting
outputtwice is an error, - setting
o,h, orfafteroutputhas been set explicitly is an error.
Without output, the single-letter options o, h and f work as previously.
There was a problem hiding this comment.
Maybe the above are too restrictive – one may want to get label table and/or listing without the object bytes, and opt 'output=spartadosx'; opt o- would be a quite self-descriptive way to spell it, even if not the most elegant.
Currently o- is allowed even mid-block, which I consider a bug because it generates broken binaries. Not sure if there's any code out there that depends on it.
I'd disallow opt o- completely after the first object byte is emitted, unless there is a good reason to keep it allowed between blocks.
There was a problem hiding this comment.
It may also make sense to get o out of output (so the latter would only set h and f), and provide 'object=on|off' so that it can be set in one opt with output.
There was a problem hiding this comment.
Ignore the last two comments. I don't think there's a use case for o- after output=....
bf51875 to
e0a9180
Compare

Prerequisite for stuff like
opt 'cpu=65c02'(#16) oropt 'format=sdx'(#17).