diff --git a/src/commands/settings.ts b/src/commands/settings.ts index ccc7f7a..91f9bc5 100644 --- a/src/commands/settings.ts +++ b/src/commands/settings.ts @@ -4,11 +4,14 @@ import settings from '~/settings' export default function registerSettingsCommand(program: Command) { program.command('settings') - .argument('[name]', 'Name of setting') - .argument('[value]', 'Value of setting') + .argument('[name]', 'Name of setting (can be key=value format)') + .argument('[value]', 'Value of setting (optional if name is name=value)') .option('-s, --set', 'Set the value of the setting') .description('Get or set stax settings') .action((name, value, options) => { + if (name?.includes('=')) + [name, value, options.set] = [...name.split('='), true] + if (options.set) { value = settings.write(name, value) console.log(`${icons.saved} Setting for '${name}' set to '${value}'`) diff --git a/src/settings.ts b/src/settings.ts index c6c76f6..83bb8d7 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -3,7 +3,7 @@ import { exit, verifyDirectory, resolve } from './utils' import yaml from 'js-yaml' import * as path from 'path' -const VALID_NAMES = [ 'aliases','services_home', 'editor' ] +const VALID_NAMES = [ 'aliases','services_home', 'editor', 'environment' ] function filename(): string { return path.join(process.env.STAX_HOME, 'settings.yaml')