Documentation
¶
Overview ¶
Package app builds the gt command tree and its injected dependencies.
Index ¶
- func DraftPath(err error) string
- func Execute(ctx context.Context, deps Dependencies, args []string) error
- func ExecuteGH(ctx context.Context, deps Dependencies, args []string) error
- func Explain(ctx context.Context, deps Dependencies, err error) error
- func GenMan(command *cobra.Command, header *doc.GenManHeader, w io.Writer) error
- func GenMarkdown(command *cobra.Command, w io.Writer) error
- func JSONErrors(deps Dependencies) bool
- func ManualCommands(page *cobra.Command) []*cobra.Command
- func ManualDate(getenv func(string) string) time.Time
- func ManualRoot() *cobra.Command
- func NewRoot(deps Dependencies) *cobra.Command
- func ReferenceRoot() *cobra.Command
- func WriteErrorJSON(w io.Writer, message string, err error) error
- type Dependencies
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DraftPath ¶
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
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
GenMarkdown writes the reference page of command like GenMan.
func JSONErrors ¶ added in v1.1.0
func JSONErrors(deps Dependencies) bool
JSONErrors reports whether failures are to be reported as JSON.
func ManualCommands ¶
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 ¶
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
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
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.
func WriteErrorJSON ¶ added in v1.1.0
WriteErrorJSON writes the failure err with its exit code and message to w as one line of JSON: {"error":{"code":4,"kind":"authentication","message":"...","status":401}}. status, the HTTP status of the Gitea answer, and draft, where a canceled text was saved, appear only when they apply.
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
// ServerVersion reads an instance's Gitea version; nil asks the instance.
ServerVersion func(context.Context, *transport.Client) (string, error)
// 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.
Source Files
¶
- action_jobs.go
- action_logs.go
- action_runs.go
- action_values.go
- actions.go
- admin.go
- admin_users.go
- api.go
- app.go
- args.go
- artifacts.go
- auth.go
- auth_accounts.go
- auth_login.go
- auth_status.go
- branches.go
- browse.go
- browser.go
- checkout.go
- checks.go
- comments.go
- completion.go
- config.go
- deadline.go
- deploy_keys.go
- diff_review.go
- discussion_search.go
- discussion_view.go
- doctor.go
- download.go
- dry_run.go
- editor.go
- error_json.go
- errors.go
- extension_commands.go
- extension_create.go
- extension_install.go
- extensions.go
- gh_shim.go
- git.go
- git_credentials.go
- gitea_version.go
- gpg_keys.go
- help_topics.go
- human_output.go
- issue_actions.go
- issue_attachments.go
- issue_edit.go
- issue_move.go
- issues.go
- label_export.go
- labelfile.go
- labels.go
- list_select.go
- man.go
- metadata.go
- milestone_issues.go
- milestone_state.go
- notifications.go
- organizations.go
- owner_scope.go
- packages.go
- project.go
- project_workflow.go
- projects.go
- prompts.go
- pull_actions.go
- pull_backport.go
- pull_clean.go
- pull_create.go
- pull_edit.go
- pull_list_local.go
- pull_mutations.go
- pull_review.go
- pull_review_lifecycle.go
- pull_review_requests.go
- pull_update.go
- pulls.go
- ref.go
- refused_other.go
- release_assets.go
- releases.go
- repo_clone.go
- repo_create.go
- repo_edit.go
- repo_migrate.go
- repo_mutations.go
- repo_sync.go
- repo_templates.go
- repos.go
- runners.go
- schema.go
- search.go
- ssh_keys.go
- status.go
- target.go
- teams.go
- time.go
- timeline.go
- upgrade.go
- webhooks.go
- wiki.go