Skip to content

Commit

Permalink
chore: Revert options & yargs parser changes (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored Mar 10, 2024
1 parent c70ce34 commit 4fc66f6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
18 changes: 15 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

var fs = require('fs');
var path = require('path');
var log = require('gulplog');

var log = require('gulplog');
var yargs = require('yargs');
var Liftoff = require('liftoff');
var interpret = require('interpret');
var v8flags = require('v8flags');
Expand All @@ -12,7 +13,7 @@ var chalk = require('chalk');
var exit = require('./lib/shared/exit');
var tildify = require('./lib/shared/tildify');
var makeTitle = require('./lib/shared/make-title');
var parser = require('./lib/shared/options/parser');
var cliOptions = require('./lib/shared/options/cli-options');
var completion = require('./lib/shared/completion');
var cliVersion = require('./package.json').version;
var toConsole = require('./lib/shared/log/to-console');
Expand Down Expand Up @@ -52,7 +53,18 @@ var cli = new Liftoff({
},
});

var opts = parser.argv;
var usage =
'\n' + chalk.bold('Usage:') +
' gulp ' + chalk.blue('[options]') + ' tasks';

var parser = yargs
.help(false)
.version(false)
.detectLocale(false)
.usage(usage)
.options(cliOptions);

var opts = parser.parse();

cli.on('preload:before', function(name) {
log.info('Preloading external module:', chalk.magenta(name));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
'use strict';

var chalk = require('chalk');
var yargs = require('yargs');

var usage =
'\n' + chalk.bold('Usage:') +
' gulp ' + chalk.blue('[options]') + ' tasks';

var options = {
help: {
Expand Down Expand Up @@ -121,8 +116,4 @@ var options = {
}
};

var parser = yargs
.help(false).version(false).detectLocale(false)
.usage(usage).options(options);

module.exports = parser;
module.exports = options;
4 changes: 3 additions & 1 deletion test/fixtures/logging.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var log = require('gulplog');
var yargs = require('yargs');
var toConsole = require('../../lib/shared/log/to-console');
var cliOptions = require('../../lib/shared/options/cli-options');

var opts = require('../../lib/shared/options/parser').argv;
var opts = yargs.options(cliOptions).parse();

toConsole(log, opts);

Expand Down

0 comments on commit 4fc66f6

Please sign in to comment.