/** * Manage configuration settings. */ import { Args, Command, Flags } from "@oh-my-pi/pi-utils/cli"; import { type ConfigAction, type ConfigCommandArgs, runConfigCommand } from "../cli/config-cli"; import { initTheme } from "../modes/theme/theme"; const ACTIONS: ConfigAction[] = ["list", "get", "set", "reset", "path", "init-xdg"]; export default class Config extends Command { static description = "Manage configuration settings"; static args = { action: Args.string({ description: "Config action", required: false, options: ACTIONS, }), key: Args.string({ description: "Setting key", required: false, }), value: Args.string({ description: "Value (for set/reset)", required: false, multiple: true, }), }; static flags = { json: Flags.boolean({ description: "Output JSON" }), }; async run(): Promise { const { args, flags } = await this.parse(Config); const action = (args.action ?? "list") as ConfigAction; const value = Array.isArray(args.value) ? args.value.join(" ") : args.value; const cmd: ConfigCommandArgs = { action, key: args.key, value, flags: { json: flags.json, }, }; await initTheme(); await runConfigCommand(cmd); } }