refactor: convert edge:channels:(un)?assign command to yargs#771
Conversation
|
b8efe22 to
9088df0
Compare
| 'assign the specified driver to the specified channel', | ||
| ], | ||
| ]) | ||
| .epilog(apiDocsURL('createDriverChannel')) |
There was a problem hiding this comment.
Should there also be an example using driver-version?
There was a problem hiding this comment.
I didn't include one because that is rarely, if ever, needed.
|
|
||
| await command.client.channels.assignDriver(channelId, driverId, driverVersion) | ||
|
|
||
| console.log(`${driverId}${argv.version ? ` (version ${argv.version})` : ''} assigned to channel ${channelId}`) |
There was a problem hiding this comment.
Does this want to be driverVersion rather than argv.version? Also, if the latter, shouldn't it be argv.driverVersion?
There was a problem hiding this comment.
Oh, good catch. I actually removed the ternary and just used the local variable driverVersion since it seems silly to me now to leave out the version used just because the user didn't specify it. (I don't know what I was thinking when I originally wrote that.)
| })) | ||
| return allChannels.filter(channel => channelsToKeep.includes(channel.channelId)) | ||
| } | ||
| return allChannels |
There was a problem hiding this comment.
Why does it compile a list of channelIds and then filter the channel list by that rather than compile a list of channels?
There was a problem hiding this comment.
Because that didn't occur to me. I've changed the capture list to a list of channels and removed the filter.
acbb01e to
59a3ca2
Compare
edge:channels:unassignandedge:channels:assigncommands to yargschooseChannelfunction to support a specified driver id so if the user specified a driver id but no channel, we only present them with channels that have that driver assignedchooseChannelfunction to usecreateChooseFn