Skip to content

Commit

Permalink
refactor: splited the JSON renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
kurone-kito committed May 6, 2021
1 parent ff57cd1 commit 92b755a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 1 addition & 4 deletions packages/dantalion-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions packages/dantalion-cli/src/render/showJson.ts
Original file line number Diff line number Diff line change
@@ -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));

0 comments on commit 92b755a

Please sign in to comment.