cmd

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package cmd provides shared utilities for internal CLI commands.

Index

Constants

This section is empty.

Variables

View Source
var ErrFeatureNameRequired = errors.New(
	"a feature name is required in non-interactive/CI mode (one of: " +
		strings.Join(generator.ToggleableFeatures, ", ") + ")")

ErrFeatureNameRequired is returned when `gtb enable`/`gtb disable` is run with no feature name in a context where the interactive picker cannot run (CI or a non-interactive session).

View Source
var ErrRemoteTemplateDeclined = errors.New("remote template source not confirmed")

ErrRemoteTemplateDeclined is returned when the operator declines the first-use trust confirmation for a remote template source.

Functions

func ConfirmRemoteTemplate added in v0.18.0

func ConfirmRemoteTemplate(p *props.Props, ci bool, ts generator.TemplateSource) error

ConfirmRemoteTemplate runs the first-use trust confirmation for a remote (git) template source. Adding a remote source IS the trust decision — GTB renders template content the framework did not author, so the operator must explicitly accept the host/owner/repo and ref before it is fetched.

Local sources need no confirmation (the operator already owns the path). In a non-interactive session (CI, --ci, GTB_NON_INTERACTIVE) the prompt is skipped and the source is accepted: supplying --template in CI is itself the explicit acceptance, mirroring the signing wizard's CI behaviour.

func ResolveProjectPath

func ResolveProjectPath(p *props.Props, path string) string

ResolveProjectPath resolves the project root from the given path. If path is "." (the default), it attempts workspace detection by walking up from CWD to find a .gtb/manifest.yaml. If detection fails, the original path is returned unchanged (the user may be generating a new project).

func RunFeatureToggle added in v0.18.0

func RunFeatureToggle(cmd *cobra.Command, p *props.Props, path string, args []string, enable bool) error

RunFeatureToggle is the shared implementation behind the positional feature arguments of `gtb enable [feature...]` and `gtb disable [feature...]`. With one or more feature names it toggles each non-interactively; with no name it opens a multi-select picker of the candidate features (the ones not already in the target state). enable selects the direction.

Types

This section is empty.

Directories

Path Synopsis
Package disable is the gtb-only `disable` command, the inverse of internal/cmd/enable.
Package disable is the gtb-only `disable` command, the inverse of internal/cmd/enable.
Package enable is the gtb-only `enable` command.
Package enable is the gtb-only `enable` command.
Package generate provides Cobra commands for scaffolding new CLI projects (project/skeleton), adding commands to existing projects, converting implementations to AI-generated code, and adding flags to commands — all driven by manifest definitions and interactive wizards.
Package generate provides Cobra commands for scaffolding new CLI projects (project/skeleton), adding commands to existing projects, converting implementations to AI-generated code, and adding flags to commands — all driven by manifest definitions and interactive wizards.
Package keys is the gtb-only `keys` command group.
Package keys is the gtb-only `keys` command group.
Package regenerate provides Cobra commands for regenerating project command registration files (cmd.go) and manifests from existing project structure, without overwriting implementation files unless explicitly forced.
Package regenerate provides Cobra commands for regenerating project command registration files (cmd.go) and manifests from existing project structure, without overwriting implementation files unless explicitly forced.
Package remove provides the Cobra command for removing commands and their associated generated files from a project, updating the manifest accordingly.
Package remove provides the Cobra command for removing commands and their associated generated files from a project, updating the manifest accordingly.
Package root provides the internal root command for the gtb CLI itself, registering the generate, regenerate, and remove subcommand groups.
Package root provides the internal root command for the gtb CLI itself, registering the generate, regenerate, and remove subcommand groups.
Package sign is the gtb-only `gtb sign` command.
Package sign is the gtb-only `gtb sign` command.
Package template is the gtb-only `template` command group.
Package template is the gtb-only `template` command group.

Jump to

Keyboard shortcuts

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