surfer/src/commands/set.ts
2022-06-23 13:54:39 +10:00

25 lines
647 B
TypeScript

import { config } from '..'
import { log } from '../log'
import { dynamicConfig } from '../utils'
export const set = (key: string, value?: string) => {
if (key == 'version') {
console.log(
config.brands[dynamicConfig.get('brand')].release.displayVersion
)
return
}
if (!(key in dynamicConfig.defaultValues)) {
log.warning(`The key ${key} is not found within the dynamic config options`)
return
}
if (value) {
dynamicConfig.set(key as dynamicConfig.DefaultValuesKeys, value)
log.info(`Set ${key} to ${value}`)
return
}
console.log(dynamicConfig.get(key as dynamicConfig.DefaultValuesKeys))
}