diff --git a/packages/dantalion-cli/src/index.ts b/packages/dantalion-cli/src/index.ts index 7ca0d05..68555ec 100644 --- a/packages/dantalion-cli/src/index.ts +++ b/packages/dantalion-cli/src/index.ts @@ -4,10 +4,7 @@ import commander from 'commander'; import { version } from '../package.json'; import detail from './detail'; import personality from './personality'; - -const showJson = (result: unknown) => - // eslint-disable-next-line no-console - console.info(JSON.stringify(result, null, 2)); +import showJson from './render/showJson'; [detail, personality].forEach(({ action, alias, command, description }) => { commander diff --git a/packages/dantalion-cli/src/render/showJson.ts b/packages/dantalion-cli/src/render/showJson.ts new file mode 100644 index 0000000..5c67bf9 --- /dev/null +++ b/packages/dantalion-cli/src/render/showJson.ts @@ -0,0 +1,7 @@ +/** + * Render the object to JSON. + * @param result The object. + */ +export default (result: unknown): void => + // eslint-disable-next-line no-console + console.info(JSON.stringify(result, null, 2));