themekit: github.com/Shopify/themekit/src/cmdutil Index | Files | Directories

package cmdutil

import "github.com/Shopify/themekit/src/cmdutil"

Index

Package Files

interfaces.go util.go

Variables

var ErrReload = errors.New("reloading config")

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

func ForDefaultClient Uses

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 Uses

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 Uses

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.

type Ctx Uses

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) DoneTask Uses

func (ctx *Ctx) DoneTask()

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

func (*Ctx) Err Uses

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

Err acts like Printf but will display error messages better

func (*Ctx) StartProgress Uses

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 Uses

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
    NotifyFile            string
    AllEnvs               bool
    Version               string
    Prefix                string
    URL                   string
    Name                  string
    Edit                  bool
    With                  string
    List                  bool
    NoDelete              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

PathSynopsis
_mocksCode generated by mockery v1.0.0.

Package cmdutil imports 15 packages (graph) and is imported by 2 packages. Updated 2018-11-28. Refresh now. Tools for package owners.