1.0.7 • Published 11 months ago

meow-styler v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Installation

npm i meow-styler meow

Important: This module is ESM 🔆. Please read this.

Usage

meow-styler is just a helper that keeps the meow API almost the same and only adds the following options:

  • Each flag has a description field.
  • Options object includes usage, layout, colors and examples fields.
#!/usr/bin/env node

import { meows } from 'meow-styler';
import foo from './lib/index.js';

const cli = meows({
  importMeta: import.meta, // This is required
  description: 'My awesome CLI',
  usage: 'foo <input>',
  examples: c => `
  ${c.dim.cyan('$')} foo unicorns ${c.yellow('--rainbow -c')} beer
  🌈 unicorns 🍺
  `,
  helpIndent: 2,
  layout: {
    width: 90,   // output total width (for word-wrap)
    spacing: 2,  // between flag(s) and description
    indent: 2    // inner indent
  },
  colors: c => ({
    description: c.white,
    flag: c.greenBright.bold,
    flagDescription: c.white,
    title: 'yellow.italic' // can also pass a string
  }),
  flags: {
    rainbow: {
      description: 'Include a rainbow',
      type: 'boolean',
      shortFlag: 'r'
    },
    cheers: {
      description: 'Get me a drink',
      type: 'string',
      shortFlag: 'c',
      choices: ['beer', 'whisky'],
      isMultiple: true
    }
  }
});

foo(cli.input.at(0), cli.flags);

For more details about meow and options, see its repo docs.

License

MIT ©️ Onur Yıldırım (@onury).

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago