cmdutil

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReload        = errors.New("reloading config")
	ErrLiveTheme     = errors.New("cannot make changes to a live theme without an override")
	ErrDuringRuntime = errors.New("finished command with errors")
)

ErrReload is an error to return from a command if you want to reload and run again

Functions

func ForDefaultClient

func ForDefaultClient(flags Flags, args []string, handler func(*Ctx) error) error

ForDefaultClient will run in a context that runs of any available config including defaults

func ForEachClient

func ForEachClient(flags Flags, args []string, handler func(*Ctx) error) error

ForEachClient will generate a command context for all the available environments and run a command in each of those contexts

func ForSingleClient

func ForSingleClient(flags Flags, args []string, handler func(*Ctx) error) error

ForSingleClient will generate a command context for all the available environments, and run a command for the first context. If more than one environment was specified, then an error will be returned.

Types

type Ctx

type Ctx struct {
	Shop   shopify.Shop
	Conf   config
	Client shopifyClient
	Flags  Flags
	Env    *env.Env
	Args   []string
	Log    *log.Logger
	ErrLog *log.Logger

	Bar *mpb.Bar
	// contains filtered or unexported fields
}

Ctx is a specific context that a command will run in

func (*Ctx) DisableSummary added in v1.1.3

func (ctx *Ctx) DisableSummary()

DisableSummary will ensure that the file operation summary will not output at the end of the operation

func (*Ctx) DoneTask

func (ctx *Ctx) DoneTask(op file.Op)

DoneTask will mark one unit of work complete. If the context has a progress bar then it will increment it.

func (*Ctx) Err added in v0.8.1

func (ctx *Ctx) Err(msg string, inter ...interface{})

Err acts like Printf but will display error messages better

func (*Ctx) StartProgress

func (ctx *Ctx) StartProgress(count int)

StartProgress will create a new progress bar for the running context with the total amount of tasks as the count

type Flags

type Flags struct {
	ConfigPath                    string
	VariableFilePath              string
	Environments                  []string
	Directory                     string
	Password                      string
	ThemeID                       string
	Domain                        string
	Proxy                         string
	Timeout                       time.Duration
	Verbose                       bool
	DisableUpdateNotifier         bool
	IgnoredFiles                  []string
	Ignores                       []string
	DisableIgnore                 bool
	Notify                        string
	AllEnvs                       bool
	Version                       string
	Prefix                        string
	URL                           string
	Name                          string
	Edit                          bool
	With                          string
	List                          bool
	NoDelete                      bool
	AllowLive                     bool
	Live                          bool
	HidePreviewBar                bool
	DisableThemeKitAccessNotifier bool
}

Flags encapsulates all the possible flags that can be set in the themekit command line. Some of the values are used across different commands

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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