Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// All added options
const cliOptions = [
...this.globalCommand.options,
...(command ? command.options : [])
]
const mriOptions = getMriOptions(cliOptions)
// Extract everything after `--` since mri doesn't support it
let argsAfterDoubleDashes: string[] = []
const doubleDashesIndex = argv.indexOf('--')
if (doubleDashesIndex > -1) {
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1)
argv = argv.slice(0, doubleDashesIndex)
}
const parsed = mri(argv, mriOptions)
const args = parsed._
delete parsed._
const options: { [k: string]: any } = {
'--': argsAfterDoubleDashes
}
// Set option default value
const ignoreDefault =
command && command.config.ignoreOptionDefaultValue
? command.config.ignoreOptionDefaultValue
: this.globalCommand.config.ignoreOptionDefaultValue
let transforms = Object.create(null)
const main = async ctx => {
argv = mri(ctx.argv.slice(2), {
boolean: ['help'],
alias: {
help: 'h',
},
});
argv._ = argv._.slice(1);
debug = argv.debug;
apiUrl = ctx.apiUrl;
subcommand = argv._[0];
if (argv.help || !subcommand) {
help();
await exit(0);
}
const main = async ctx => {
argv = mri(ctx.argv.slice(2), {
boolean: ['help', 'debug', 'all'],
alias: {
help: 'h',
debug: 'd'
}
});
argv._ = argv._.slice(1);
if (argv.help || argv._[0] === 'help') {
help();
process.exit(0);
}
const debug = argv['--debug'];
const { authConfig: { token }, apiUrl } = ctx;
const main = async ctx => {
argv = mri(ctx.argv.slice(2), {
boolean: ['help'],
alias: {
help: 'h'
}
});
apiUrl = ctx.apiUrl;
argv._ = argv._.slice(1);
if (argv.help || argv._[0] === 'help') {
help();
await exit(0);
}
logout();
};
export async function run(
env: NodeJS.ProcessEnv,
argv: string[] = [],
): Promise {
const args = mri(argv.slice(ARGS_START), {
alias: { b: 'banner', h: 'help', m: 'sourcemap' },
boolean: ['banner', 'help', 'sourcemap'],
default: { b: true, m: true },
});
const { help, banner: hasBanner, sourcemap } = args;
if (help) {
console.log(`
Build CSS. Typically zero additional configuration is required because your
package.json is the config.
USAGE:
build-css [src] [dest] [options]
OPTIONS
-h --help Print this help message and exit.
export function getConfig(): DSLint.Configuration {
const argv = process.argv.slice(2);
const args = mri(argv);
return {
fileKey: args._.join(''),
teamId: args.teamId,
};
}
import fs from 'fs';
import path from 'path';
import chalk from 'chalk';
import mri from 'mri';
import degit from 'degit';
const args = mri(process.argv.slice(2), {
alias: {
f: 'force',
c: 'cache',
v: 'verbose'
},
boolean: ['force', 'cache', 'verbose']
});
const [src, dest = '.'] = args._;
if (args.help || !src) {
const help = fs.readFileSync(path.join(__dirname, 'help.md'), 'utf-8')
.replace(/^(\s*)#+ (.+)/gm, (m, s, _) => s + chalk.bold(_))
.replace(/_([^_]+)_/g, (m, _) => chalk.underline(_))
.replace(/`([^`]+)`/g, (m, _) => chalk.cyan(_));
const main = async ctx => {
argv = mri(ctx.argv.slice(2), {
boolean: ['help', 'debug'],
alias: {
help: 'h',
debug: 'd',
switch: 'change'
}
});
debug = argv.debug;
apiUrl = ctx.apiUrl;
const isSwitch = argv._[0] && argv._[0] === 'switch';
argv._ = argv._.slice(1);
if (isSwitch) {
const main = async ctx => {
argv = mri(ctx.argv.slice(2), {
boolean: ['help', 'debug', 'yes'],
alias: {
help: 'h',
debug: 'd',
yes: 'y',
},
});
argv._ = argv._.slice(1);
debug = argv.debug;
apiUrl = ctx.apiUrl;
subcommand = argv._[0];
if (argv.help || !subcommand) {
help();