Closed happyRip closed 1 year ago
Is this flag magic really necessary? Why don't we have commands per source with their own flag sets?
@happyRip I think this actually may be better than our current hack. We would need to generate dynamically an application
/ device
sub command per source, but I think it would indeed work better here.
What is the status here - is this blocked on anything ? Does it need any technical decision ?
Subcommands approach was merged, so this PR can be closed.
Summary
Closes #56
Changes
Add an optional positional
source
argument (pkg/arg
)Print only source-related flags with those commands
ttnv3
flags; to be followed with other sourcesSplit
application
anddevices
commands FlagSetsImproved
ttnv3
config by utilising flags that save value to variables directlyTesting
local testing
Regressions
I do not expect any.
Notes for Reviewers
If we were planning to add more commands in the future, FlagSet splitting could be upgraded to a more sophisticated solution. Currently it's pretty simple.
It was suggested to use generated commands like
tts-devices
ETC, but I wanted to propose this solution which seems to work well and is pretty simpleWhen
pflag
is used to set ActiveSource the value is set after initialisation, so the flags cannot be separated easily (duringFlagSet()
function call)Checklist
CHANGELOG.md
.