Advertisement
mjgartendev

oclif-flag-type

Apr 20th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.34 KB | None | 0 0
  1. static flags = {
  2.   name: flags.string({
  3.     char: 'n',                    // shorter flag version
  4.     description: 'name to print', // help description for flag
  5.     hidden: false,                // hide from help
  6.     multiple: false,              // allow setting this flag multiple times
  7.     env: 'MY_NAME',               // default to value of environment variable
  8.     options: ['a', 'b'],          // only allow the value to be from a discrete set
  9.     parse: input => 'output',     // instead of the user input, return a different value
  10.     default: 'world',             // default value if flag not passed (can be a function that returns a string or undefined)
  11.     required: false,              // make flag required (this is not common and you should probably use an argument instead)
  12.     dependsOn: ['extra-flag'],    // this flag requires another flag
  13.     exclusive: ['extra-flag'],    // this flag cannot be specified alongside this other flag
  14.   }),
  15.  
  16.   // flag with no value (-f, --force)
  17.   force: flags.boolean({
  18.     char: 'f',
  19.     default: true,                // default value if flag not passed (can be a function that returns a boolean)
  20.     // boolean flags may be reversed with `--no-` (in this case: `--no-force`).
  21.     // The flag will be set to false if reversed. This functionality
  22.     // is disabled by default, to enable it:
  23.     // allowNo: true
  24.   }),
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement