cmdutil

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cmdutil provides utilities for working with cobra commands

Index

Constants

View Source
const (
	SpinnerInterval = 100 * time.Millisecond
	SpinnerColor    = "green"
)

Variables

View Source
var (
	SpinnerCharSet = spinner.CharSets[78]
	SuccessIcon    = color.GreenString("✔")
)

Functions

func DisableAuthCheck

func DisableAuthCheck(cmd *cobra.Command)

func IsAuthCheckEnabled

func IsAuthCheckEnabled(cmd *cobra.Command) bool

Types

type Factory

type Factory struct {
	Log         *zap.SugaredLogger // logger
	Printer     printer.Printer    // printer
	Config      config.Config      // config(flag, env, file)
	ApiClient   api.Client         // query api
	AuthClient  auth.Client        // login, refresh token
	Prompter    prompt.Prompter    // interactive prompter
	Selector    selector.Selector  // interactive selector
	ParamFiller fill.ParamFiller   // fill params
	PersistentFlags
}

Factory is a factory for command runners It is used to pass common dependencies to commands. It is kind of like a "context" for commands.

func NewFactory

func NewFactory() *Factory

NewFactory returns a new cmd factory

func (*Factory) LoggedIn

func (f *Factory) LoggedIn() bool

type PersistentFlags

type PersistentFlags struct {
	Debug            bool // debug mode, default false
	Interactive      bool // interactive mode, default true
	AutoRefreshToken bool // auto refresh token, default true, only when token is from browser(OAuth2)
	AutoCheckUpdate  bool // auto check update, default true
}

PersistentFlags are flags that are common to all commands

Jump to

Keyboard shortcuts

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