package
Version:
v1.0.0
Opens a new window with list of versions in this module.
Published: Jun 2, 2026
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Register adds a command to the dispatch table. Commands call this from init().
Run parses argv, builds a Context, and dispatches to the matching command.
It returns a process exit code.
Args is a parsed goforge invocation using poly-style argument syntax:
goforge <command> [positional...] key:value :flag
Tokens are classified as:
- "key:value" -> a named argument (Named["key"] = "value")
- ":flag" -> a boolean flag (Flags["flag"] = true)
- bare word -> a positional argument (e.g. the create sub-type)
A value may itself contain colons (e.g. since:stable-1, out:a/b.txt); only the
first colon separates the key from the value.
Parse splits a raw argument vector (already stripped of the program name) into
the command and its arguments.
Flag reports whether a boolean flag was set.
Get returns a named argument and whether it was present.
GetOr returns a named argument or a default when absent.
Pos returns the positional argument at index i, or "" if out of range.
Command is a registered goforge subcommand.
Commands returns all registered commands sorted by name.
Lookup returns a registered command by name.
Context carries everything a command handler needs: the parsed arguments,
output streams, and the directory from which goforge was invoked.
Colors returns a colorizer honoring the color-mode argument and TTY status.
type ExitError struct{ Code int }
ExitError lets a command set the process exit code without the dispatcher
printing an error message (the command has already reported its own output).
Source Files
¶
Click to show internal directories.
Click to hide internal directories.