Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): replace optimist on yargs lib #3451

Merged
merged 1 commit into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const path = require('path')
const assert = require('assert')
const optimist = require('optimist')
const yargs = require('yargs')
const fs = require('graceful-fs')

const Server = require('./server')
Expand All @@ -11,7 +11,7 @@ const constant = require('./constants')

function processArgs (argv, options, fs, path) {
if (argv.help) {
console.log(optimist.help())
console.log(yargs.help())
process.exit(0)
}

Expand Down Expand Up @@ -152,7 +152,7 @@ function argsBeforeDoubleDash (argv) {
}

function describeShared () {
optimist
yargs
.usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
'Usage:\n' +
' $0 <command>\n\n' +
Expand All @@ -167,7 +167,7 @@ function describeShared () {
}

function describeInit () {
optimist
yargs
.usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
'INIT - Initialize a config file.\n\n' +
'Usage:\n' +
Expand All @@ -179,7 +179,7 @@ function describeInit () {
}

function describeStart () {
optimist
yargs
.usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
'START - Start the server / do a single run.\n\n' +
'Usage:\n' +
Expand All @@ -205,7 +205,7 @@ function describeStart () {
}

function describeRun () {
optimist
yargs
.usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
'RUN - Run the tests (requires running server).\n\n' +
'Usage:\n' +
Expand All @@ -221,7 +221,7 @@ function describeRun () {
}

function describeStop () {
optimist
yargs
.usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
'STOP - Stop the server (requires running server).\n\n' +
'Usage:\n' +
Expand All @@ -232,7 +232,7 @@ function describeStop () {
}

function describeCompletion () {
optimist
yargs
.usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
'COMPLETION - Bash/ZSH completion for karma.\n\n' +
'Installation:\n' +
Expand All @@ -245,7 +245,7 @@ function printRunnerProgress (data) {
}

exports.process = function () {
const argv = optimist.parse(argsBeforeDoubleDash(process.argv.slice(2)))
const argv = yargs.parse(argsBeforeDoubleDash(process.argv.slice(2)))
const options = {
cmd: argv._.shift()
}
Expand Down Expand Up @@ -280,7 +280,7 @@ exports.process = function () {
} else {
console.error('Unknown command "' + options.cmd + '".')
}
optimist.showHelp()
yargs.showHelp()
process.exit(1)
}

Expand Down
Loading