Created
October 27, 2016 05:16
-
-
Save MadLittleMods/018089c00bc9e0852112e5740cfc9a5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var argv = require('yargs').argv; | |
// See https://github.com/yargs/yargs/issues/402 | |
// This will shim the `.option({ position: x })` that was in `nomnom` but we are now using `yargs` | |
var shimPositionOption = function(optionsOpts) { | |
var opts = Object.assign({}, optionsOpts); | |
if(opts.hasOwnProperty('position') && opts.position < argv._.length) { | |
opts.default = opts.default || argv._[opts.position]; | |
} | |
return opts; | |
} | |
module.exports = shimPositionOption; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment