🎮 A delightful CLI argument parser that makes handling command-line arguments as fun as playing with LEGOs!

This module provides a powerful yet friendly way to parse command-line arguments and build CLI applications. Think of it as your trusty sidekick in the quest to create awesome command-line tools!

  • 🎯 Parse command-line arguments into a structured object
  • 🌳 Support for nested subcommands
  • 🎨 Pretty help text generation
  • 🎲 Automatic type conversion for arguments
// Create a magical spell-casting CLI!
const spellCommands: Command[] = [{
name: 'cast',
description: 'Cast a magical spell',
options: [{
name: 'power',
description: 'Spell power level (1-10)',
defaultValue: 5
}],
positionalArgs: [{
name: 'spell',
description: 'The spell to cast',
required: true
}],
action: (args) => {
console.log(`🪄 Casting ${args.spell} with power ${args.power}!`);
}
}];

const args = parseCliArgs([...$vararg]);

// Run it like: spell.lua cast fireball --power 9
executeCommand(args, spellCommands);

Type Aliases

Command
CommandOption
ParsedArgs
PositionalArgument

Functions

executeCommand
parseCliArgs
printHelp