How to use the terminalWidth function from yargs
Find comprehensive JavaScript yargs.terminalWidth code examples handpicked from public code repositorys.
81 82 83 84 85 86 87 88 89 90
} function argsParser () { return yargs .detectLocale(false) .wrap(Math.min(120, yargs.terminalWidth())) .command('$0 [files...]', '', function (yargs) { return yargs .option('doctype', { alias: 'd',
128
195
13
+ 7 other calls in file
31 32 33 34 35 36 37 38 39 40
boolean: true, default: false, description: 'output debug infos' }, }) .wrap(Math.min(120, yargsPkg.terminalWidth())) .help(); const argv = yargs.parse(); if (argv.debug) {
121
0
20
GitHub: HubSpot/hubspot-cli
53 54 55 56 57 58 59 60 61 62
shouldNotifyInNpmScript: true, message: pkg.name === '@hubspot/cms-cli' ? CLI_UPGRADE_MESSAGE : null, }); const getTerminalWidth = () => { const width = yargs.terminalWidth(); if (width >= 100) return width * 0.9; return width;
52
124
95
45 46 47 48 49 50 51 52 53 54
this.atomDirectory = config.getAtomDirectory() this.atomPackagesDirectory = path.join(this.atomDirectory, 'packages') } parseOptions (argv) { const options = yargs(argv).wrap(Math.min(100, yargs.terminalWidth())) options.usage(`\ Usage: apm upgrade apm upgrade --list
0
1
2
GitHub: gautamkrishnar/hoodie
111 112 113 114 115 116 117 118 119 120
} }) .alias('v', 'version') .env('hoodie') .epilogue('Options can also be specified as environment variables (prefixed with "hoodie_") or inside a ".hoodierc" file (json or ini).') .wrap(Math.min(150, yargs.terminalWidth())) .argv if (options.bindAddress) { log.warn('The use of --bindAddress is deprecated. Use the --address option instead.')
460
0
3
32 33 34 35 36 37 38 39 40 41
.default('m', false) .help('h') .alias('h', 'help') .strict() .wrap(Math.min(110, yargs.terminalWidth())) .argv const buildDir = path.resolve(__dirname, '../../build/') const builtFileNames = fs.readdirSync(buildDir).filter(x => !config.m ? !x.endsWith('.map') : x)
26
39
10
GitHub: sophos/factory-cli
91 92 93 94 95 96 97 98 99 100
return true; }) .demandCommand(1, 'Command must be specified.') .help() .wrap(Math.min(120, yargs.terminalWidth())).argv; }; export type Args = Omit<ReturnType<typeof parse>, 'address'> & { address: string;
4
1
3
16 17 18 19 20 21 22 23 24 25
.commandDir('../cmds').demandCommand(1, 'Please specify command to execute') .epilog('Copyright 2017 Volodymyr Shymanskyy') .alias('h', 'help') .global('version', false) .completion('completion', false) .strict().wrap(Math.min(120, yargs.terminalWidth())) .recommendCommands(); //yargs.group(['help', 'verbose', 'silent'], 'Global Arguments:'); //yargs.count('verbose').alias('v', 'verbose');
4
0
0
yargs.argv is the most popular function in yargs (1012 examples)