Documentation
¶
Overview ¶
Package cmd implements the stacked command-line dispatcher and all of its subcommands. Subcommands self-register via init() functions calling register.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute() (rc int)
Execute parses os.Args, dispatches to the matching subcommand, and returns the process exit code. With no arguments, or help/-h/--help, it prints help and returns 0. version/-v/--version prints the version and returns 0. An unknown command prints an error to stderr and returns 1. A command that returns an error prints "st: <err>" to stderr and returns 1. A panic in any command is recovered into a structured error and exitInternal so the process never crashes with a raw stack trace and the runtime's exit code 2. help and version accept --json and emit the same information as a machine-readable payload.
Types ¶
type Command ¶
type Command struct {
// Name is the primary invocation name of the command.
Name string
// Aliases are alternate names that also invoke the command.
Aliases []string
// Summary is a one-line description shown in help output.
Summary string
// Usage is a short usage string, e.g. "st create <name> [-m <msg>] [-a]".
Usage string
// Run executes the command with the arguments following the command name.
Run func(args []string) error
// NewFlagSet, when set, builds a fresh flag set declaring every flag the
// command accepts, for help introspection. Run builds its set from the same
// per-command constructor (cmd/flagsets.go), so a command's flags are declared
// once and `help --json` cannot drift from what Run parses. Commands whose
// only flag is --json leave it nil.
NewFlagSet func() *flag.FlagSet
}
Command describes a single stacked subcommand.
Source Files
¶
- abort.go
- absorb.go
- bottom.go
- checkout.go
- color.go
- completion.go
- continue.go
- create.go
- delete.go
- down.go
- flags.go
- flagsets.go
- fold.go
- gitenv.go
- guide.go
- init.go
- log.go
- modify.go
- mutate.go
- onto.go
- rename.go
- render.go
- repair.go
- restack.go
- root.go
- sanitize.go
- shell.go
- squash.go
- status.go
- submit.go
- sync.go
- top.go
- track.go
- undo.go
- untrack.go
- up.go
- validate.go
- worktree.go
- worktree_cache.go
- worktree_copy.go