···11+#! /usr/bin/env node
22+33+import {disableAutomaticSwitching} from '../functions/index.js';
44+55+export async function disable() {
66+ await disableAutomaticSwitching();
77+88+ console.log('Automatic switching disabled');
99+}
+24
actions/enable.js
···11+import {config} from "../config.js";
22+import {packageJson} from "../constants/index.js";
33+import {enableAutomaticSwitching} from "../functions/index.js";
44+55+export async function enable({darkProfile, lightProfile}) {
66+ if (!darkProfile && !config.darkProfile) {
77+ throw new Error(
88+ `Dark profile must be specified with --dark-profile or previously set with \`${packageJson.name} set-dark-mode\``,
99+ );
1010+ }
1111+1212+ if (!lightProfile && !config.lightProfile) {
1313+ throw new Error(
1414+ `Light profile must be specified with --light-profile or previously set with \`${packageJson.name} set-light-mode\``,
1515+ );
1616+ }
1717+1818+ if (darkProfile) config.darkProfile = darkProfile;
1919+ if (lightProfile) config.lightProfile = lightProfile;
2020+2121+ await enableAutomaticSwitching();
2222+2323+ console.log('Automatic switching enabled');
2424+}
+5
actions/index.js
···11+export {disable} from './disable.js'
22+export {enable} from './enable.js'
33+export {setModeProfile} from './set-mode-profile.js'
44+export {status} from './status.js'
55+export {updateProfile} from './update-profile.js'
+7
actions/set-mode-profile.js
···11+import {config} from "../config.js";
22+33+export function setModeProfile({mode, profile}) {
44+ config[`${mode}Profile`] = profile;
55+66+ console.log(`${mode} mode profile set to '${profile}'`);
77+}