meow-styler
v1.0.7
Published
Colors & formatting for meow CLI app helper.
Downloads
68
Maintainers
Readme
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
andexamples
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).