2017-02-02 07:46:56 +03:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2018-06-09 02:35:55 +03:00
|
|
|
/* tslint:disable */
|
|
|
|
|
2018-06-02 03:26:20 +03:00
|
|
|
import * as yargs from "yargs"
|
|
|
|
import { log } from "./lib/util/logging"
|
2017-01-17 09:14:02 +03:00
|
|
|
|
2018-05-30 09:53:02 +03:00
|
|
|
const defaultLogDir = log.directory
|
2018-06-02 03:26:20 +03:00
|
|
|
|
2018-06-09 02:35:55 +03:00
|
|
|
const packageVersion = require("../package.json").version
|
2017-02-02 07:46:56 +03:00
|
|
|
|
2017-01-17 09:14:02 +03:00
|
|
|
yargs
|
2017-04-29 06:19:22 +03:00
|
|
|
.version(packageVersion)
|
2018-06-02 03:26:20 +03:00
|
|
|
.commandDir("lib/commands")
|
2017-12-12 02:00:14 +03:00
|
|
|
.strict()
|
2018-06-02 03:26:20 +03:00
|
|
|
.option("h", { alias: "help" })
|
|
|
|
.option("l", {
|
|
|
|
alias: "logLevel",
|
|
|
|
describe: "Set the logging level for console.",
|
|
|
|
choices: ["off", "json", "error", "warn", "info", "verbose", "debug", "silly"],
|
|
|
|
default: "info",
|
2017-02-02 07:46:56 +03:00
|
|
|
})
|
2018-06-02 03:26:20 +03:00
|
|
|
.option("f", {
|
|
|
|
alias: "logFilepath",
|
2017-04-29 06:19:22 +03:00
|
|
|
describe: `Set the log file path. It must be an absolute filepath. ` +
|
2018-06-02 03:26:20 +03:00
|
|
|
`By default the logs will stored in a timestamp based log file at "${defaultLogDir}".`,
|
2017-02-02 07:46:56 +03:00
|
|
|
})
|
2018-07-16 23:34:18 +03:00
|
|
|
.option("p", {
|
|
|
|
alias: "pretty",
|
|
|
|
describe: `Pretty print`
|
|
|
|
})
|
|
|
|
.global(["h", "l", "f", "p"])
|
2017-01-17 09:14:02 +03:00
|
|
|
.help()
|
2018-06-09 02:35:55 +03:00
|
|
|
.argv;
|
2017-01-17 09:14:02 +03:00
|
|
|
|
2017-02-24 22:06:31 +03:00
|
|
|
if (yargs.argv._.length === 0 && yargs.argv.h === false) {
|
2018-07-16 23:34:18 +03:00
|
|
|
yargs.coerce("help", _ => true).argv;
|
2018-06-02 03:26:20 +03:00
|
|
|
}
|