Skip to content

Commit 44d2c83

Browse files
committed
Add plain output format
1 parent 6a92d51 commit 44d2c83

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/main.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const mainArgs = [
2020
name: 'format',
2121
alias: 'f',
2222
type: String,
23-
description: 'Specify the output format: console (default) or json'
23+
description: 'Specify the output format: console (default), plain, or json'
2424
},
2525
{ name: 'help', alias: 'h', type: Boolean, description: 'Print this help message' },
2626
{
@@ -65,6 +65,8 @@ const calculateCode = args => {
6565

6666
if (args.format === 'json') {
6767
writeJson(result, null, ' ');
68+
} else if (args.format === 'plain') {
69+
write(code);
6870
} else {
6971
write(
7072
chalk.green.bold(code),
@@ -83,7 +85,7 @@ const calculateCode = args => {
8385
try {
8486
if (!args.format) args.format = 'console';
8587

86-
if (!['console', 'json'].includes(args.format)) {
88+
if (!['console', 'json', 'plain'].includes(args.format)) {
8789
throw 'Invalid format';
8890
}
8991

0 commit comments

Comments
 (0)