{"id":"horsenuggets/commandline-luau","name":"commandline-luau","scope":"horsenuggets","platform":"roblox","description":"A CLI builder for Luau.","version":"0.2.14","latest":"0.2.14","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","0.2.4","0.2.5","0.2.6","0.2.7","0.2.8","0.2.9","0.2.10","0.2.11","0.2.12","0.2.13","0.2.14"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"horsenuggets/t":{"version":"^3.1.1-horse.0.5","alias":"t"}},"integrity":"c71e77acad15e4c5eca97f581b4ffdb95b0ddd49a92488271adf2753d09d7f9a","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## Runtime Requirements\n\nUse the maintained Lune fork selected by `rokit.toml`. Consumers must select a runtime\nthat provides `stdio.terminalCapabilities()` and semantic prompt foregrounds, including\nnamed and bright color support. Wally installs the Luau package, not its native runtime.\n\nUnconfirmed terminal opacity falls back to RGB gray. A missing native API indicates an\nunsupported runtime, not an unsupported terminal; it is not silently treated as a\nnegative capability result.\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\n## Terminal Output\n\n`Commandline.Terminal` writes styled lines with an optional timestamp prefix. Each kind of\ntext has a helper that paints it from the theme...\n\n```luau\nlocal terminal = Commandline.Terminal.new({ Timestamps = \"stopwatch\" })\nCommandline.Terminal.setDefault(terminal)\n\nterminal:Print(terminal:Heading(\"Building my-app...\"))\nterminal:Print(terminal:Step(1, 3, `Building {terminal:Path(\"C:\\\\Users\\\\me\\\\My Place.rbxl\")}...`))\nterminal:Print(`Listening on {terminal:Address(\"localhost:34872\")}.`)\nterminal:Print(`Downloaded {terminal:Count(15)} packages!`)\nterminal:Print(terminal:Success(\"Build completed successfully!\"))\n```\n\n`Path` shows every path with forward slashes, collapses the home folder to `~`, ends\ndirectories with `/` when given `{ Directory = true }`, and shows spaces as `·`. Place and\nmodel files use the Roblox path style (cyan bold), and other paths are gray.\n\n**Timestamps**\n\nPass `Timestamps` as a setting string or a `Commandline.Timestamp` config...\n\n- `disabled` → No prefix (the default).\n- `stopwatch` → Time since the terminal was created, like `[00:01.234]`.\n- `utc` → UTC wall clock time, like `[19:05:09.042]`.\n- `local` → Local wall clock time.\n- `utc+9`, `utc-05:30` → Wall clock time at a fixed offset.\n\nSetting the `COMMANDLINE_TIMESTAMPS` environment variable to any of these overrides the\napp's choice, and `NO_COLOR` turns color off. Lines printed to a terminal window wrap at\nword boundaries, with continuation lines aligned after the timestamp. Pass `Columns` to\nchoose a width, or `0` to never wrap. `terminal:Stream()` returns a writer that splits\nstreamed output, such as a child process's standard output, into timestamped lines.\n\n**Themes**\n\nEvery theme entry (`Address`, `Count`, `Error`, `Faint`, `Heading`, `Identifier`, `Muted`,\n`Path`, `RobloxPath`, `StepBracket`, `StepCurrent`, `StepTotal`, `Success`,\n`TimestampBracket`, `TimestampFaint`, `TimestampText`, `Url`, and `Warning`) can be\noverridden with a spec of `Bold`, `Color`, `Dim`, `Italic`, and `Underline`. Colors are\nnames like `cyanBright` or hex values like `#96cc22`. Secondary text uses solid RGB gray.\nTimestamp brackets and leading zeros use the same gray with `Dim`, whose intensity or\nopacity is controlled by the terminal. For example...\n\n```luau\nlocal terminal = Commandline.Terminal.new({\n    Theme = {\n        Heading = { Bold = true, Color = \"magentaBright\" },\n        Path = { Color = \"#8a8a8a\", Italic = true },\n    },\n})\n```\n\nFor terminals that support foreground RGBA (such as GhosttyX), explicitly set `Opacity`\nfrom `0` to `1` alongside a hex `Color`. For example,\n`TimestampFaint = { Color = \"#a8a8a8\", Opacity = 0.25 }` uses alpha `64/255`, approximately\n25%. The same override on `TimestampBracket` fades the brackets. Overrides replace the\nwhole spec, so these do not inherit `Dim`. Do not add `Dim` unless you want its intensity\nreduction multiplied by the explicit opacity.\n\nThis opts into the `ESC[38:6::R:G:B:Am` terminal extension, not ordinary truecolor. Only\nuse it on terminals known to support RGBA; no terminal capability is inferred. Ordinary\nstyles omit `Opacity` and keep their existing ANSI output. Closing the foreground style\nrestores full opacity, and disabling color emits no RGBA sequences.\n\nLibrary code such as `Toolkit` prints through `Commandline.Terminal.default()`, so an app\nthat calls `setDefault` at startup gets the same timestamps and theme everywhere.\n","readmeTruncated":false}