Set --ch-index to a newly added channel when --ch-add is set, to allow further modification #508
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This isn't quite the fix as described in the issue, but I believe fixes #507 a bit more nicely even than that.
Currently, if you were to pass all of
--ch-add
,--ch-index
, and--ch-set
, the CLI would first add a channel at the first available index, but then the--ch-set
would apply to whatever channel was at--ch-index
, which needn't necessarily match the channel that was just added. That is, a command like:would first add "test" as one of channels 1-7 (assuming one was available), and then set the primary channel to the default PSK and turn uplink on.
With this change,
--ch-add
won't allow--ch-index
to be set along with it, and after adding the channel, will instead set the channel index to that value. That way, the above command would error, but the following:would, instead, add a channel called "test" with the default PSK and uplink enabled.
I think this is a lot more intuitive and more in line with the usual philosophy of this command line where a single command is intended, generally, to modify only one thing. Hopefully y'all agree!