Skip to content

Commit

Permalink
feat: cli interface support list (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
xudafeng authored Jul 19, 2019
1 parent 72b98bc commit fdb109e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $ npm i macaca-cli -g

## Common Usage

Live sample & docs: [link](//macacajs.github.io/quick-start)
Live sample & docs: [link](//macacajs.github.io/guide/quick-start.html)

## License

Expand Down
46 changes: 23 additions & 23 deletions bin/macaca-cli-run
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

'use strict';

var fs = require('fs');
var path = require('path');
var EOL = require('os').EOL;
var program = require('commander');
var Convert = require('ansi-to-html');
const fs = require('fs');
const path = require('path');
const EOL = require('os').EOL;
const program = require('commander');
const Convert = require('ansi-to-html');

var _ = require('../lib/common/helper');
var createRunner = require('../lib').Runner;
var logger = require('../lib/common/logger');
var format = require('../lib/common/logFormatter');
const _ = require('../lib/common/helper');
const createRunner = require('../lib').Runner;
const logger = require('../lib/common/logger');
const format = require('../lib/common/logFormatter');

var options = {
const options = {
verbose: false,
framework: 'mocha',
port: 3456,
Expand All @@ -23,19 +23,19 @@ var options = {
};

program
.option('-f, --framework <s>', 'Set test framework (defaults: ' + options.framework + ')')
.option('-p, --port <d>', 'Set port for server (defaults: ' + options.port + ')')
.option('-d, --directory <s>', 'Set directory for task runner (defaults: ' + options.directory + ')')
.option('-o, --output [s]', 'Set output html file')
.option('-r, --reporter <s>', 'Set reporter (default: Spec)')
.option('-c, --colors <s>', 'Force enabling of colors (defaults: ' + options.colors + ')')
.option('-C, --no-colors', 'Force disabling of colors')
.option('--require <name>', 'Require the given module')
.option('--f_options <s>', 'The options used for test framework itself')
.option('--coverage-ignore <s>', 'Ignore RegExp used for macaca-coverage')
.option('--no-window', 'Let Electron runs in silence')
.option('--parallel', 'Let Electron run in parallel process')
.option('--verbose', 'Displays more debugging information')
.option('-f, --framework <s>', 'Set test framework (defaults: ' + options.framework + ')')
.option('-p, --port <d>', 'Set port for server (defaults: ' + options.port + ')')
.option('-d, --directory <items>', 'Set directory for task runner (defaults: ' + options.directory + ')', value => value.split(','))
.option('-o, --output [s]', 'Set output html file')
.option('-r, --reporter <s>', 'Set reporter (default: Spec)')
.option('-c, --colors <s>', 'Force enabling of colors (defaults: ' + options.colors + ')')
.option('-C, --no-colors', 'Force disabling of colors')
.option('--require <name>', 'Require the given module')
.option('--f_options <s>', 'The options used for test framework itself')
.option('--coverage-ignore <s>', 'Ignore RegExp used for macaca-coverage')
.option('--no-window', 'Let Electron runs in silence')
.option('--parallel', 'Let Electron run in parallel process')
.option('--verbose', 'Displays more debugging information')
.parse(process.argv);

_.merge(options, _.getConfig(program));
Expand Down
10 changes: 7 additions & 3 deletions lib/run/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ Runner.prototype.initFramework = function() {
}
}

let args = [
options.directory || defaultOpt.directory
];
let args = [];

if (options.directory) {
args = args.concat(options.directory);
} else {
args.push(defaultOpt.directory);
}

if (!_.platform.isWindows) {
args.unshift(frameworkBin);
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-cli",
"version": "2.1.12",
"version": "2.2.0",
"description": "Macaca command-line interface",
"keywords": [
"automation",
Expand All @@ -23,7 +23,7 @@
"ansi-to-html": "~0.3.0",
"cli-table": "~0.3.1",
"co": "~4.6.0",
"commander": "^2.9.0",
"commander": "^2.20.0",
"macaca-coverage": "^1.0.0",
"macaca-doctor": "~2.0.3",
"macaca-logo": "^1.0.0",
Expand Down Expand Up @@ -55,10 +55,7 @@
"pre-commit": "npm run lint"
}
},
"engines": {
"node": ">=8"
},
"homepage": "https://macacajs.github.io",
"changelog": "https://macacajs.github.io/guide/support.html",
"changelog": "https://macacajs.github.io/guide/roadmap.html",
"license": "MIT"
}

0 comments on commit fdb109e

Please sign in to comment.