cmd

package
v0.0.0-...-e110ede Latest Latest
Warning

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

Go to latest
Published: May 18, 2016 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthNone    = "none"
	AuthCluster = "cluster"
)

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "kel",
	Short: "Kel end-user command-line tool",
}

RootCmd is ...

Functions

func LoadConfig

func LoadConfig()

LoadConfig loads the global Kel configuration

func LoadPlugins

func LoadPlugins()

LoadPlugins will load configured plugins for the activated site.

func SyncSitePlugins

func SyncSitePlugins(site *kel.Site)

SyncSitePlugins will sync the local state of plugins match what the site is providing.

Types

type Config

type Config struct {
	DefaultCluster *URI                     `json:"cluster,omitempty"`
	Auth           string                   `json:"auth,omitempty"`
	Sites          map[string]*SiteConfig   `json:"sites"`
	Tokens         map[string]*oauth2.Token `json:"tokens"`
	Plugins        map[string]*Plugin       `json:"plugins"`
}

Config is the global configuration for the Kel command-line client.

func (*Config) AddPlugin

func (config *Config) AddPlugin(plugin *Plugin)

AddPlugin will add the given plugin to the site config.

func (*Config) Save

func (config *Config) Save()

Save will persist configuration to disk.

type Plugin

type Plugin struct {
	Name    string        `json:"name,omitempty"`
	Version string        `json:"version,omitempty"`
	Command PluginCommand `json:"command,omitempty"`
}

Plugin represents a Kel client plugin.

func (*Plugin) AsCmd

func (plugin *Plugin) AsCmd() *cobra.Command

AsCmd returns a cobra.Command based on dynamic plugin values.

func (*Plugin) BinaryPath

func (plugin *Plugin) BinaryPath() string

BinaryPath will return the full filesystem path to the binary for this plugin.

func (*Plugin) Install

func (plugin *Plugin) Install() error

Install will download and install the plugin binary.

func (*Plugin) String

func (plugin *Plugin) String() string

type PluginCommand

type PluginCommand struct {
	BinaryURL string `json:"binary_url,omitempty"`
	Use       string `json:"use,omitempty"`
	Short     string `json:"short,omitempty"`
}

PluginCommand represents the client command plugin

type SiteConfig

type SiteConfig struct {
	URI     *URI              `json:"uri,omitempty"`
	Plugins map[string]string `json:"plugins"`
}

func GetActivatedSiteConfig

func GetActivatedSiteConfig() *SiteConfig

GetActivatedSiteConfig will return the activated site config or nil

func (*SiteConfig) AddPlugin

func (siteConfig *SiteConfig) AddPlugin(plugin *Plugin)

AddPlugin will add the given plugin to the site config.

type TokenSaver

type TokenSaver interface {
	Save(*oauth2.Token) error
}

type URI

type URI struct {
	Host          string `json:"host"`
	ResourceGroup string `json:"resource-group,omitempty"`
	Site          string `json:"site,omitempty"`
	Insecure      bool   `json:"insecure"`
}

URI is the structured form of host/resource-group</site>?opts

func LookupURI

func LookupURI() (URI, error)

LookupURI will find the most relevant URI string and parse it.

func ParseURI

func ParseURI(value string) (URI, error)

ParseURI will parse a given string into a URI

func (URI) Equals

func (uri URI) Equals(other URI) bool

Equals will test equality of two URIs

func (URI) String

func (uri URI) String() string

Jump to

Keyboard shortcuts

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