Documentation
¶
Index ¶
- func BootstrapInvocationContext(args []string) (cmdutil.InvocationContext, error)
- func Build(ctx context.Context, inv cmdutil.InvocationContext, opts ...BuildOption) *cobra.Command
- func Execute() int
- func RegisterGlobalFlags(fs *pflag.FlagSet, opts *GlobalOptions)
- func SetDefaultFS(fs vfs.FS)
- type BuildOption
- type GlobalOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootstrapInvocationContext ¶ added in v1.0.5
func BootstrapInvocationContext(args []string) (cmdutil.InvocationContext, error)
BootstrapInvocationContext extracts global invocation options before the real command tree is built, so provider-backed config resolution sees the correct profile from the start.
func Build ¶ added in v1.0.16
func Build(ctx context.Context, inv cmdutil.InvocationContext, opts ...BuildOption) *cobra.Command
Build constructs the full command tree without executing. Returns only the cobra.Command; Factory is internal. Use Execute for the standard production entry point.
func RegisterGlobalFlags ¶ added in v1.0.5
func RegisterGlobalFlags(fs *pflag.FlagSet, opts *GlobalOptions)
RegisterGlobalFlags registers the root-level persistent flags on fs and applies any visibility policy encoded in opts. Pure function: no disk, network, or environment reads — the caller decides HideProfile.
func SetDefaultFS ¶ added in v1.0.16
SetDefaultFS replaces the global filesystem implementation used by internal packages. The provided fs must implement the vfs.FS interface. If fs is nil, the default OS filesystem is restored.
Call this before Build or Execute to take effect.
Types ¶
type BuildOption ¶ added in v1.0.16
type BuildOption func(*buildConfig)
BuildOption configures optional aspects of the command tree construction.
func HideProfile ¶ added in v1.0.16
func HideProfile(hide bool) BuildOption
HideProfile sets the visibility policy for the root-level --profile flag. When hide is true the flag stays registered (so existing invocations still parse) but is omitted from help and shell completion. Typically called as HideProfile(isSingleAppMode()).
func WithIO ¶ added in v1.0.16
func WithIO(in io.Reader, out, errOut io.Writer) BuildOption
WithIO sets the IO streams for the CLI by wrapping raw reader/writers. Terminal detection is delegated to cmdutil.NewIOStreams.
func WithKeychain ¶ added in v1.0.16
func WithKeychain(kc keychain.KeychainAccess) BuildOption
WithKeychain sets the secret storage backend. If not provided, the platform keychain is used.
type GlobalOptions ¶ added in v1.0.5
GlobalOptions are the root-level flags shared by bootstrap parsing and the actual Cobra command tree. Profile is the parsed --profile value; HideProfile is a build-time policy — when true, --profile stays parseable but is marked hidden from help and shell completion.