{"id":"horsenuggets/commandline-luau","name":"commandline-luau","scope":"horsenuggets","platform":"roblox","description":"A CLI builder for Luau.","version":"0.2.3","latest":"0.2.3","versions":["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9","0.0.10","0.0.11","0.0.12","0.0.13","0.0.14","0.0.15","0.0.16","0.1.0","0.2.0","0.2.1","0.2.2","0.2.3"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"horsenuggets/chalk-luau":{"version":"^1.0.1","alias":"Chalk"},"horsenuggets/t":{"version":"^3.1.1-horse.0.4","alias":"t"}},"integrity":"63de67a3fc9bd9ea5707380e63051b7f6ed6f9927a5a5223f17bdf584c656a60","likes":0,"downloads":0,"install":"forest install horsenuggets/commandline-luau","url":"https://forest.dev/p/roblox/horsenuggets/commandline-luau","files":"https://api.forest.dev/ai/package/roblox/horsenuggets/commandline-luau/files","readme":"# commandline-luau\n\nA CLI builder for Luau.\n\n## Basic Usage\n\n```luau\nlocal Commandline = require(\"@packages/Commandline\")\n\n-- Create a simple command\nlocal greet = Commandline.Command.new({\n    Name = \"greet\",\n    Description = \"Greet someone by name.\",\n    Args = {\n        Commandline.Arg.new({\n            Name = \"name\",\n            Description = \"The name to greet.\",\n        }),\n    },\n    Impl = function(args, flags)\n        print(`Hello, {args.name}!`)\n    end,\n})\n\n-- Register and execute\nCommandline.registerCommand(greet)\nCommandline.execute(\"greet world\")  -- Prints: Hello, world!\n```\n\n## Arguments\n\nArguments are positional and required by default:\n\n```luau\nCommandline.Arg.new({\n    Name = \"count\",\n    Description = \"Number of times to repeat.\",\n    Type = \"int\",  -- \"boolean\", \"int\", \"number\", or \"string\" (default)\n})\n```\n\nOptional arguments with defaults:\n\n```luau\nCommandline.Arg.new({\n    Name = \"count\",\n    Type = \"int\",\n    Required = false,\n    Default = 1,\n})\n```\n\n## Flags\n\nFlags are optional and support both long (`--name`) and short (`-n`) forms:\n\n```luau\n-- Boolean flag (no value)\nCommandline.Flag.new({\n    Name = \"verbose\",\n    Shorthand = \"v\",\n    Description = \"Enable verbose output.\",\n})\n\n-- Typed flag (requires a value)\nCommandline.Flag.new({\n    Name = \"count\",\n    Shorthand = \"c\",\n    Type = \"int\",\n    Default = 1,\n    Description = \"Number of iterations.\",\n})\n```\n\nAccess flags in your implementation:\n\n```luau\nImpl = function(args, flags)\n    if flags.verbose.Value then\n        print(\"Verbose mode enabled\")\n    end\n    local count = flags.count.Value\nend\n```\n\n## Subcommands\n\nCommands can have subcommands instead of arguments:\n\n```luau\nlocal app = Commandline.Command.new({\n    Name = \"app\",\n    Description = \"My CLI application.\",\n    Subcommands = {\n        Commandline.Command.new({\n            Name = \"init\",\n            Description = \"Initialize a new project.\",\n            Impl = function() print(\"Initializing...\") end,\n        }),\n        Commandline.Command.new({\n            Name = \"build\",\n            Description = \"Build the project.\",\n            Impl = function() print(\"Building...\") end,\n        }),\n    },\n})\n```\n\n## Help\n\nA `--help` / `-h` flag is automatically added to all commands.\n","readmeTruncated":false}