How to use the @oclif/command.flags.option function in @oclif/command

To help you get started, we’ve selected a few @oclif/command examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jmerle / png-to-box2d / src / commands / generate.ts View on Github external
`$ png-to-box2d generate images/castle.png
Converted image in images/castle.png to triangulated shapes in images/castle.png.json
`,
    `$ png-to-box2d generate --overwrite --tolerance 5 images/castle.png out/triangles.json
Converted image in images/castle.png to triangulated shapes in out/triangles.json
`,
  ];

  public static flags = {
    ...BaseCommand.flags,
    overwrite: flags.boolean({
      char: 'o',
      description: 'overwrite the output file if it exists',
      default: false,
    }),
    tolerance: flags.option({
      char: 't',
      description: `
path tolerance in px where less tolerance means more triangles per shape
see https://mourner.github.io/simplify-js/ for more information
      `.trim(),
      default: 2.5,
      parse: parseFloat,
    }),
    alpha: flags.option({
      char: 'a',
      description: `
the percentage of when an alpha value should be seen as part of the background
when set to X, every pixel that has a transparency of at least X% will be seen as part of the background
      `.trim(),
      default: 25,
      parse: parseFloat,
github jmerle / png-to-box2d / src / commands / generate.ts View on Github external
...BaseCommand.flags,
    overwrite: flags.boolean({
      char: 'o',
      description: 'overwrite the output file if it exists',
      default: false,
    }),
    tolerance: flags.option({
      char: 't',
      description: `
path tolerance in px where less tolerance means more triangles per shape
see https://mourner.github.io/simplify-js/ for more information
      `.trim(),
      default: 2.5,
      parse: parseFloat,
    }),
    alpha: flags.option({
      char: 'a',
      description: `
the percentage of when an alpha value should be seen as part of the background
when set to X, every pixel that has a transparency of at least X% will be seen as part of the background
      `.trim(),
      default: 25,
      parse: parseFloat,
    }),
    path: flags.boolean({
      char: 'p',
      description: 'include the full paths of the shapes in the generated json file',
      default: false,
    }),
    beautify: flags.boolean({
      char: 'b',
      description: 'beautify the generated json file',