Skip to content

Commit

Permalink
feat(xo-cli): better output for returned values
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-f committed Feb 23, 2023
1 parent 4f63d14 commit c8b29da
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions packages/xo-cli/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,15 @@ main(process.argv.slice(2)).then(
process.exitCode = result
} else {
const { stdout } = process
stdout.write(typeof result === 'string' ? result : inspect(result))
stdout.write(
typeof result === 'string'
? result
: inspect(result, {
colors: true,
depth: null,
sorted: true,
})
)
stdout.write('\n')
}
}
Expand All @@ -544,7 +552,15 @@ main(process.argv.slice(2)).then(
const { stderr } = process
stderr.write(chalk.bold.red('✖'))
stderr.write(' ')
stderr.write(typeof error === 'string' ? error : inspect(error))
stderr.write(
typeof error === 'string'
? error
: inspect(error, {
colors: true,
depth: null,
sorted: true,
})
)
stderr.write('\n')
process.exitCode = 1
}
Expand Down

0 comments on commit c8b29da

Please sign in to comment.