app

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 55 Imported by: 0

Documentation

Overview

Package app builds the gt command tree and its injected dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DraftPath

func DraftPath(err error) string

DraftPath returns the file that holds the unsubmitted text of a failed command, or "".

func Execute

func Execute(ctx context.Context, deps Dependencies, args []string) error

Execute expands aliases and executes the fresh root without printing errors.

func ExecuteGH added in v1.0.0

func ExecuteGH(ctx context.Context, deps Dependencies, args []string) error

ExecuteGH answers the gh commands an extension installed with --compat-gh runs as the matching gt commands: gh api, gh repo view with gt's JSON fields and gh auth token. GH_TOKEN and GH_HOST stand in for GITEA_TOKEN and GITEA_CLI_HOST when those are not set.

func Explain

func Explain(ctx context.Context, deps Dependencies, err error) error

Explain words a command failure for people. It adds the next step to refusals Gitea explains, and words rejected credentials, unreachable servers and expired timeouts. Exit codes are unchanged.

func GenMan added in v1.0.0

func GenMan(command *cobra.Command, header *doc.GenManHeader, w io.Writer) error

GenMan writes the man page of command. A help topic takes no flags, so its page lists none, and the root page refers to the topics, which Cobra skips as hidden.

func GenMarkdown added in v1.0.0

func GenMarkdown(command *cobra.Command, w io.Writer) error

GenMarkdown writes the reference page of command like GenMan.

func ManualCommands

func ManualCommands(page *cobra.Command) []*cobra.Command

ManualCommands lists the subcommands that get a page in the manual: the available commands, without the generated help command, and the help topics such as environment and exit-codes.

func ManualDate

func ManualDate(getenv func(string) string) time.Time

ManualDate dates man pages from SOURCE_DATE_EPOCH, falling back to a fixed date so the manual stays reproducible when the variable is unset.

func ManualRoot added in v1.0.0

func ManualRoot() *cobra.Command

ManualRoot returns the built-in command tree prepared for man pages. md2man drops a <placeholder> as inline HTML and reads _WORD_ as emphasis, so both are escaped outside indented code blocks.

func NewRoot

func NewRoot(deps Dependencies) *cobra.Command

NewRoot builds fresh commands. Construction performs no disk, network, or Git IO.

func ReferenceRoot added in v1.0.0

func ReferenceRoot() *cobra.Command

ReferenceRoot returns the built-in command tree prepared for the Markdown reference, which drops a <placeholder> outside code as inline HTML too. Its usage line is a code block.

Types

type Dependencies

type Dependencies struct {
	Browser       terminal.Browser
	Editor        terminal.Editor
	Pager         terminal.Pager
	Executable    func() (string, error)
	Git           git.Runner
	Now           func() time.Time
	Settings      *settings.Store
	Credentials   *auth.Store
	Streams       terminal.Streams
	Prompter      terminal.Prompter
	IssueForm     terminal.IssueForm
	IssueEditForm terminal.IssueEditForm
	PullForm      terminal.PullForm
	ReviewForm    terminal.ReviewForm
	MergeForm     terminal.MergeForm
	MilestoneForm terminal.MilestoneForm
	ReleaseForm   terminal.ReleaseForm
	RepoForm      terminal.RepoForm
	LabelForm     terminal.LabelForm
	Getenv        func(string) string
	LookupEnv     func(string) (string, bool)
	Client        func(string, string, bool) *transport.Client
	// DataDir holds installed extensions; PolicyFile is the system policy, which may not exist.
	DataDir    string
	PolicyFile string
	// Environ is the environment extensions inherit, without gt's secrets.
	Environ      func() []string
	RunExtension func(extensions.Command) (int, error)
	GitHub       func() github.Client
}

Dependencies supplies external boundaries for a fresh CLI invocation.

func System

func System() Dependencies

System connects the CLI to the current environment and terminal.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL