diff --git a/packages/cli/src/commands/database/config.ts b/packages/cli/src/commands/database/config.ts index eeb6252d4..c000afd79 100644 --- a/packages/cli/src/commands/database/config.ts +++ b/packages/cli/src/commands/database/config.ts @@ -1,5 +1,5 @@ import { logtoConfigGuards, LogtoConfigKey, logtoConfigKeys } from '@logto/schemas'; -import { deduplicate } from '@silverhand/essentials'; +import { deduplicate, noop } from '@silverhand/essentials'; import chalk from 'chalk'; import { CommandModule } from 'yargs'; @@ -28,8 +28,8 @@ const validateKeys: ValidateKeysFunction = (keys) => { } }; -export const getConfig: CommandModule = { - command: 'get-config [keys...]', +const getConfig: CommandModule = { + command: 'get [keys...]', describe: 'Get config value(s) of the given key(s) in Logto database', builder: (yargs) => yargs @@ -68,8 +68,8 @@ export const getConfig: CommandModule }, }; -export const setConfig: CommandModule = { - command: 'set-config ', +const setConfig: CommandModule = { + command: 'set ', describe: 'Set config value of the given key in Logto database', builder: (yargs) => yargs @@ -95,3 +95,12 @@ export const setConfig: CommandModule = log.info(`Update ${chalk.green(key)} succeeded`); }, }; + +const config: CommandModule = { + command: ['config', 'configs'], + describe: 'Commands for Logto database config', + builder: (yargs) => yargs.command(getConfig).command(setConfig).demandCommand(1), + handler: noop, +}; + +export default config; diff --git a/packages/cli/src/commands/database/index.ts b/packages/cli/src/commands/database/index.ts index 265e559e8..226da93f9 100644 --- a/packages/cli/src/commands/database/index.ts +++ b/packages/cli/src/commands/database/index.ts @@ -2,14 +2,13 @@ import { noop } from '@silverhand/essentials'; import { CommandModule } from 'yargs'; import alteration from './alteration'; -import { getConfig, setConfig } from './config'; +import config from './config'; import seed from './seed'; const database: CommandModule = { command: ['database', 'db'], describe: 'Commands for Logto database', - builder: (yargs) => - yargs.command(getConfig).command(setConfig).command(seed).command(alteration).demandCommand(1), + builder: (yargs) => yargs.command(config).command(seed).command(alteration).demandCommand(1), handler: noop, };