(argv: ArgumentsCamelCase<CommandArgs>)
| 37 | .epilog(buildEpilog({ command, apiDocs: 'changeMode' })) |
| 38 | |
| 39 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 40 | const command = await apiCommand(argv) |
| 41 | |
| 42 | const [modeId, locationId] = await chooseMode(command, argv.id, { locationId: argv.location }) |
| 43 | await command.client.modes.setCurrent(modeId, locationId) |
| 44 | |
| 45 | const mode = await command.client.modes.get(modeId, locationId) |
| 46 | const name = mode.label ?? mode.name ?? 'unnamed mode' |
| 47 | const location = await command.client.locations.get(locationId) |
| 48 | |
| 49 | console.log(`current mode for ${location.name} (${location.locationId}) set to ${name} (${mode.id})`) |
| 50 | } |
| 51 | |
| 52 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 53 | export default cmd |
nothing calls this directly
no test coverage detected