Documentation ¶
Index ¶
- Constants
- Variables
- func ParseVisSpec(specJSON string) (*vispb.Vis, error)
- type Arg
- type BundleManager
- func (b *BundleManager) AddScript(script *ExecutableScript) error
- func (b BundleManager) GetOrderedScripts() []*ExecutableScript
- func (b BundleManager) GetScript(scriptName string) (*ExecutableScript, error)
- func (b BundleManager) GetScripts() []*ExecutableScript
- func (b BundleManager) MustGetScript(scriptName string) *ExecutableScript
- type BundleWriter
- type ExecutableScript
- type FlagSet
Constants ¶
const ( AgentStatusScript = "px/agent_status" ServiceStatsScript = "px/service_stats" )
This file has a list of well known scripts, that can be referenced from various part of the CLI.
Variables ¶
var ErrMissingRequiredArgument = errors.New("missing required argument")
ErrMissingRequiredArgument specifies that a required script flag has not been provided.
var ( // ErrScriptNotFound is returned when the requested script does not exist. ErrScriptNotFound = errors.New("Script not found (run `px run -l` to list available scripts)") )
Functions ¶
Types ¶
type BundleManager ¶
type BundleManager struct {
// contains filtered or unexported fields
}
BundleManager reads a script bundle.
func NewBundleManagerWithOrg ¶
func NewBundleManagerWithOrg(bundleFiles []string, orgID, orgName string) (*BundleManager, error)
NewBundleManagerWithOrg reads the json bundle and initializes the bundle reader for a specific org.
func (*BundleManager) AddScript ¶
func (b *BundleManager) AddScript(script *ExecutableScript) error
AddScript adds the specified script to the bundle manager.
func (BundleManager) GetOrderedScripts ¶
func (b BundleManager) GetOrderedScripts() []*ExecutableScript
GetOrderedScripts returns metadata about available scripts ordered by the name of the script.
func (BundleManager) GetScript ¶
func (b BundleManager) GetScript(scriptName string) (*ExecutableScript, error)
GetScript returns the script by name.
func (BundleManager) GetScripts ¶
func (b BundleManager) GetScripts() []*ExecutableScript
GetScripts returns metadata about available scripts.
func (BundleManager) MustGetScript ¶
func (b BundleManager) MustGetScript(scriptName string) *ExecutableScript
MustGetScript is GetScript with fatal on error.
type BundleWriter ¶
type BundleWriter struct {
// contains filtered or unexported fields
}
BundleWriter creates script bundle files.
func NewBundleWriter ¶
func NewBundleWriter(searchPaths []string, basePaths []string) *BundleWriter
NewBundleWriter created a new BundleWriter.
func (*BundleWriter) Write ¶
func (b *BundleWriter) Write(outFile string) error
Writer writes the bundle file to the specified output.
type ExecutableScript ¶
type ExecutableScript struct { ScriptString string ScriptName string ShortDoc string LongDoc string Vis *vispb.Vis OrgID string Hidden bool // Marks if this script is local rather than hosted. IsLocal bool // Args contains a map from name to argument info. Args map[string]Arg }
ExecutableScript is the basic script entity that can be run.
func (*ExecutableScript) ComputedArgs ¶
func (e *ExecutableScript) ComputedArgs() ([]Arg, error)
ComputedArgs returns the args as an array.
func (*ExecutableScript) GetFlagSet ¶
func (e *ExecutableScript) GetFlagSet() *FlagSet
GetFlagSet returns the flagset for this script based on the variables.
func (ExecutableScript) LiveViewLink ¶
func (e ExecutableScript) LiveViewLink(clusterID *string) string
LiveViewLink returns the fully qualified URL for the live view.
func (*ExecutableScript) UpdateFlags ¶
func (e *ExecutableScript) UpdateFlags(fs *FlagSet) error
UpdateFlags updates the flags based on the passed in flag set.
type FlagSet ¶
type FlagSet struct {
// contains filtered or unexported fields
}
FlagSet is a wrapper around flag.FlagSet, because the latter does not support required args without a default value.
func (*FlagSet) Lookup ¶
Lookup wraps flag.FlagSet's Lookup function, returning an error if we look up a required arg (without a default value) that hasn't been set.