Skip to content

Commit

Permalink
allow environment setting with name=value
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed Nov 25, 2024
1 parent 5d2b922 commit 86bcc19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/commands/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}'`)
Expand Down
2 changes: 1 addition & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 86bcc19

Please sign in to comment.