Skip to content

Commit

Permalink
Add screenmute command
Browse files Browse the repository at this point in the history
  • Loading branch information
jadoc committed Nov 26, 2023
1 parent b3ecc43 commit 4872d0c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Inputs,
Keys,
PictureModes,
ScreenMuteModes,
} from './constants/TV.js';

function createCommand(name: string, description: string) {
Expand Down Expand Up @@ -208,6 +209,25 @@ export function makeProgram() {
}),
);

const screenmute = createCommand(
'screenmute',
'Blank either the input video or the entire screen.',
)
.addArgument(
new Argument('<mode>', 'Named screen mute mode.').choices([
...Object.keys(ScreenMuteModes),
]),
)
.action(
wrapTVAction(async (tv, mode) => {
await tv.connect();
await tv.setScreenMute(
ScreenMuteModes[mode as keyof typeof ScreenMuteModes],
);
await tv.disconnect();
}),
);

const program = new Command()
.requiredOption('-o, --host <address>', 'IP or DNS address of TV.')
.option('-m, --mac <address>', 'MAC address of TV. Required for power on.')
Expand Down Expand Up @@ -239,7 +259,8 @@ export function makeProgram() {
.addCommand(energysaving)
.addCommand(key)
.addCommand(mac)
.addCommand(picturemode);
.addCommand(picturemode)
.addCommand(screenmute);

return program;
}
Expand Down

0 comments on commit 4872d0c

Please sign in to comment.