Closed LodewijkSioen closed 5 months ago
Thank you for the contribution, @LodewijkSioen! We're currently discussing this with the team. We're trying to decide if the way you've done it is best (which is very clear but adds three new options to the CLI) or if it might be better to introduce a single option for which the thing you're overriding is part of the value (e.g., -ig version:1.2.3 -ig status:draft -ig releaselable:qa-draft
). The single option is a tiny bit harder to use, but allows for easily supporting other overrides without continuing to increase the number of different option flags. Do you have any thoughts on this?
@cmoesel I'm ok with that. I can imagine the option bloat. However, I don't see a way to do that using commander.js except custom option parsing. This would introduce a bunch of parsing logic. Alternatively, the IG override options could be a json string.
One drawback is that the built-in --help
documentation will be less useful.
Hi @LodewijkSioen. I apologize for the delay in responding. We've discussed this some more as a team, and we do think that this feature would work better as a single option (perhaps -c
/ --config
since you're overriding config data). We feel that this is actually more user-friendly because having too many command-line options can be overwhelming.
I don't think having the user express overrides as a JSON string would be very user-friendly. But I also don't think that you need to implement this using commander's custom option parsing. I'd suggest that you specify the option as a variadic option. This would allow users to pass the option multiple times (e.g., -c version:1.2.3 -c status:draft
), which makes the resulting option value an array (e.g., ['version:1.2.3', 'status:draft']
). Then in updateConfig, you just iterate that array, split each item on :
to get your key and value, and set it in the config (with perhaps a gating function to ensure only allowed keys are used).
How does that sound to you?
Sounds good to me. This seems more elegant and in line with how most command line options work. I can take a stab at it the week after next.
@cmoesel is this more like it?
Prettier should be fixed now.
Release notes updated
1439
Added command line option to override some elements in sushi-config.yaml: