meow-with-subcommands

As the name says: The meow module with subcommands

MIT License

Downloads
8
Stars
0

meow-with-subcommands

Mostly superceded by peowly-commands

Helper for handling subcommands with meow

Usage

Basic

import { meowWithSubcommands } from 'meow-with-subcommands';

await meowWithSubcommands(
  {
    foo: {
      description: 'Do something very foo-like',
      async run (argv, importMeta, { parentName }) {
        // Do whatever you like, eg. initiate a new meow or meow-with-subcommands
      }
    }
  },
  {
    aliases: {
      fs: {
        description: 'Alias for "foo --strict"',
        argv: ['foo', '--strict']
      },
    },
    argv: process.argv.slice(2),
    name: 'name-of-cli',
    importMeta: import.meta
  }
)

Complete

See example-folder

API

meowWithSubcommands(commands, { [aliases], argv, name, ...meowOptions }) => Promise<void>

prepareFlags

printFlagList

printHelpList

Extracted from

  • SocketDev/socket-cli-js – I found the pattern I created for this open source CLI to be quite helpful and wanted to reuse it

See also