···11+import {Argument, Command} from '@commander-js/extra-typings';
22+import {getTerminalProfiles} from 'mac-terminal';
33+import * as actions from '../../actions/index.js';
44+55+/**
66+ * Make set mode command
77+ *
88+ * @param {'dark' | 'light'} mode
99+ */
1010+export default async function setMode(mode) {
1111+ return new Command(mode)
1212+ .description(`set terminal profile for ${mode}`)
1313+ .addArgument(
1414+ new Argument('<profile>', 'terminal profile name').choices(
1515+ await getTerminalProfiles(),
1616+ ),
1717+ )
1818+ .action(async (profile) => actions.config.setMode({mode, profile}));
1919+}
+14
source/cli/commands/config/set.js
···11+import {Command} from '@commander-js/extra-typings';
22+import {modes} from '../../../library/index.js';
33+import * as actions from '../../actions/index.js';
44+import setMode from './set-mode.js';
55+66+const command = new Command('set').description('update configuration');
77+88+for (const mode of modes) {
99+ command.addCommand(await setMode(mode));
1010+}
1111+1212+command.action(actions.config.set);
1313+1414+export default command;
+6
source/cli/commands/config/show.js
···11+import {Command} from 'commander';
22+import * as actions from '../../actions/index.js';
33+44+export default new Command('show')
55+ .description('show configuration')
66+ .action(actions.config.show);
+13
source/cli/commands/update.js
···11+import {Argument, Command} from '@commander-js/extra-typings';
22+import {modes} from '../../library/index.js';
33+import * as actions from '../actions/index.js';
44+55+export default new Command('update')
66+ .description('update terminal profile based on the mode')
77+ .addArgument(
88+ new Argument(
99+ '[mode]',
1010+ 'appearance mode. defaults to current system appearance mode.',
1111+ ).choices(modes),
1212+ )
1313+ .action(async (mode) => actions.update({mode}));
-2
source/commands/config/commands/index.js
···11-export {default as show} from './show.js';
22-export {default as set} from './set/index.js';
···11import {Command} from 'commander';
22-import {show, set} from './commands/index.js';
22+import show from './show.js';
33+import set from './set.js';
3445export default new Command('config')
56 .description('manage configuration')