Files
speckle-server/packages/server/modules/cli/index.js
T
Iain Sproat 78ecaeffcb Revert structured logging 2 (#1240)
* Revert "'@' shortcut must come after it is configured in bootstrap (#1239)"

This reverts commit 967329473f.

* Revert "Structured logging (attempt 2) (#1234)"

This reverts commit 444d2ca7dd.
2022-12-05 15:46:09 +00:00

29 lines
781 B
JavaScript

const path = require('path')
const yargs = require('yargs')
require('../../bootstrap')
const execution = yargs
.scriptName('yarn cli')
.usage('$0 <cmd> [args]')
.commandDir(path.resolve(__dirname, './commands'), { extensions: ['js', 'ts'] })
.demandCommand()
.fail((msg, err, yargs) => {
if (!err) {
// If validation error (no err instance) then just show help and show the message
console.error(yargs.help())
console.error('\n', msg)
} else {
// If actual app error occurred, show the msg, but don't show help info
console.error(err)
console.error('\n', 'Specify --help for available options')
}
process.exit(1)
})
.help().argv
const promise = Promise.resolve(execution)
promise.then(() => {
yargs.exit(0)
})