Documentation ¶
Index ¶
- Constants
- func Close()
- func CompareBinary(runtimeBin string, newBin string) error
- func CopyFile(runtimeBin string, targetBin string) error
- func Open(name string, enable bool) (*typeColours, error)
- func SprintError(err error) string
- func Sprintf(format string, args ...interface{}) string
- func SprintfBlue(format string, args ...interface{}) string
- func SprintfCyan(format string, args ...interface{}) string
- func SprintfDebug(format string, args ...interface{}) string
- func SprintfError(format string, args ...interface{}) string
- func SprintfGreen(format string, args ...interface{}) string
- func SprintfInfo(format string, args ...interface{}) string
- func SprintfMagenta(format string, args ...interface{}) string
- func SprintfNormal(format string, args ...interface{}) string
- func SprintfOk(format string, args ...interface{}) string
- func SprintfRed(format string, args ...interface{}) string
- func SprintfWarning(format string, args ...interface{}) string
- func SprintfWhite(format string, args ...interface{}) string
- func SprintfYellow(format string, args ...interface{}) string
- type Environment
- type ExecArgs
- func (r *ExecArgs) Add(a ...string) *ExecArgs
- func (r *ExecArgs) Append(a ...string) *ExecArgs
- func (r *ExecArgs) Get(index int) string
- func (r *ExecArgs) GetAll() []string
- func (r *ExecArgs) GetFrom(lower int) []string
- func (r *ExecArgs) GetFromSize(begin int, size int) []string
- func (r *ExecArgs) Range(lower int, upper int) []string
- func (r *ExecArgs) Set(a ...string) *ExecArgs
- func (r *ExecArgs) Sprintf() string
- func (r *ExecArgs) SprintfFrom(lower int) string
- func (r *ExecArgs) SprintfFromSize(lower int, upper int) string
- func (r *ExecArgs) SprintfRange(lower int, upper int) string
- func (r *ExecArgs) String() string
- func (r *ExecArgs) ToString() string
- type ExecEnv
- type FlagValue
- type GoRuntime
- type SelfUpdateArgs
- type State
- func (s *State) GetError() error
- func (s *State) GetOk() error
- func (s *State) GetState() error
- func (s *State) GetWarning() error
- func (s *State) IsError() bool
- func (s *State) IsNotError() bool
- func (s *State) IsNotOk() bool
- func (s *State) IsOk() bool
- func (s *State) SetError(format string, args ...interface{})
- func (s *State) SetOk(format string, args ...interface{})
- func (s *State) SetWarning(format string, args ...interface{})
- type StringValue
- type TargetFile
- type UrlValue
- func (v *UrlValue) GetShortUrl() string
- func (v *UrlValue) GetUrl() string
- func (v *UrlValue) IsEmpty() bool
- func (v *UrlValue) IsNil() bool
- func (v *UrlValue) IsNotEmpty() bool
- func (v *UrlValue) IsNotNil() bool
- func (v *UrlValue) IsNotValid() bool
- func (v *UrlValue) IsValid() bool
- func (v *UrlValue) Set(args ...string) error
- func (v *UrlValue) String() string
- type User
- type Ux
- func (u *Ux) PrintError(err error)
- func (u *Ux) Printf(format string, args ...interface{})
- func (u *Ux) PrintfBlue(format string, args ...interface{})
- func (u *Ux) PrintfCyan(format string, args ...interface{})
- func (u *Ux) PrintfDebug(format string, args ...interface{})
- func (u *Ux) PrintfError(format string, args ...interface{})
- func (u *Ux) PrintfGreen(format string, args ...interface{})
- func (u *Ux) PrintfInfo(format string, args ...interface{})
- func (u *Ux) PrintfMagenta(format string, args ...interface{})
- func (u *Ux) PrintfNormal(format string, args ...interface{})
- func (u *Ux) PrintfOk(format string, args ...interface{})
- func (u *Ux) PrintfRed(format string, args ...interface{})
- func (u *Ux) PrintfWarning(format string, args ...interface{})
- func (u *Ux) PrintfWhite(format string, args ...interface{})
- func (u *Ux) PrintfYellow(format string, args ...interface{})
- func (u *Ux) PrintflnBlue(format string, args ...interface{})
- func (u *Ux) PrintflnCyan(format string, args ...interface{})
- func (u *Ux) PrintflnError(format string, args ...interface{})
- func (u *Ux) PrintflnGreen(format string, args ...interface{})
- func (u *Ux) PrintflnInfo(format string, args ...interface{})
- func (u *Ux) PrintflnMagenta(format string, args ...interface{})
- func (u *Ux) PrintflnNormal(format string, args ...interface{})
- func (u *Ux) PrintflnOk(format string, args ...interface{})
- func (u *Ux) PrintflnRed(format string, args ...interface{})
- func (u *Ux) PrintflnWarning(format string, args ...interface{})
- func (u *Ux) PrintflnWhite(format string, args ...interface{})
- func (u *Ux) PrintflnYellow(format string, args ...interface{})
- type Version
- func (v *Version) AddArgs(a ...string)
- func (v *Version) AddFullArgs(a ...string)
- func (v *Version) AttachCommands(cmd *cobra.Command, disableVflag bool) State
- func (v *Version) AutoRun() State
- func (v *Version) CmdHelp() State
- func (v *Version) CmdVersion(cmd *cobra.Command, args ...string) State
- func (v *Version) CmdVersionCheck() State
- func (v *Version) CmdVersionInfo(args ...string) State
- func (v *Version) CmdVersionList(args ...string) State
- func (v *Version) CmdVersionShow() State
- func (v *Version) CmdVersionUpdate() State
- func (v *Version) CreateDummyBinary() State
- func (v *Version) EnsureNotNil() *Version
- func (v *Version) FetchVersion(version *VersionValue) *selfupdate.Release
- func (v *Version) FlagCheckVersion(cmd *cobra.Command) bool
- func (v *Version) GetArg(index int) string
- func (v *Version) GetArgRange(lower int, upper int) []string
- func (v *Version) GetArgs() []string
- func (v *Version) GetBinaryRepo() string
- func (v *Version) GetCmd() *cobra.Command
- func (v *Version) GetEnvMap() *Environment
- func (v *Version) GetFullArgs() []string
- func (v *Version) GetName() string
- func (v *Version) GetNargs(begin int, size int) []string
- func (v *Version) GetRepo() string
- func (v *Version) GetSemVer() *VersionValue
- func (v *Version) GetSourceRepo() string
- func (v *Version) GetTimeout() string
- func (v *Version) GetVersion() string
- func (v *Version) GetVersionValue() *VersionValue
- func (v *Version) IsBootstrapBinary() bool
- func (v *Version) IsMac() bool
- func (v *Version) IsNotValid() bool
- func (v *Version) IsOsx() bool
- func (v *Version) IsRunningAs(run string) bool
- func (v *Version) IsRunningAsFile() bool
- func (v *Version) IsRunningAsLink() bool
- func (v *Version) IsUpdated(print bool) State
- func (v *Version) IsValid() bool
- func (v *Version) IsWindows() bool
- func (v *Version) PrintNameVersion()
- func (v *Version) PrintSummary(release *github.RepositoryRelease) State
- func (v *Version) PrintVersion(version *VersionValue) State
- func (v *Version) PrintVersionSummary(version string) State
- func (v *Version) Set(s SelfUpdateArgs) State
- func (v *Version) SetArgs(a ...string)
- func (v *Version) SetBinaryRepo(value ...string) State
- func (v *Version) SetCmd(a ...string) error
- func (v *Version) SetDebug(value bool) State
- func (v *Version) SetFullArgs(a ...string)
- func (v *Version) SetName(value string) State
- func (v *Version) SetOldVersion(value string) State
- func (v *Version) SetRepo(value ...string) State
- func (v *Version) SetRepos(source string, binary string) State
- func (v *Version) SetSourceRepo(value ...string) State
- func (v *Version) SetVersion(value string) State
- func (v *Version) SprintfArgRange(lower int, upper int) string
- func (v *Version) SprintfArgsFrom(lower int) string
- func (v *Version) SprintfNargs(lower int, upper int) string
- func (v *Version) TimeStampEpoch() int64
- func (v *Version) TimeStampString() string
- func (v *Version) Update() State
- func (v *Version) UpdateTo(newVersion *VersionValue) State
- type VersionValue
Constants ¶
View Source
const ( LatestVersion = "latest" LatestSemVer = "0.0.0" CurrentVersion = "current" EarliestSemVer = "0.0.1" // Using semver, "0.0.0" is defined as "latest". CmdSelfUpdate = "selfupdate" CmdVersion = "version" CmdVersionInfo = "info" CmdVersionList = "list" CmdVersionLatest = "latest" CmdVersionCheck = "check" CmdVersionUpdate = "update" FlagVersion = "version" DefaultRepoServer = "github.com" BootstrapBinaryName = "bootstrap" DefaultVersion = "0.4.2" )
View Source
const DefaultVersionTemplate = `
{{with .Name}}{{printf "%s " .}}{{end}} {{printf "version %s" .Version}}
`
View Source
const Group = "Version"
Variables ¶
This section is empty.
Functions ¶
func CompareBinary ¶
func SprintError ¶
func SprintfBlue ¶
func SprintfCyan ¶
func SprintfDebug ¶
func SprintfError ¶
func SprintfGreen ¶
func SprintfInfo ¶
func SprintfMagenta ¶
func SprintfNormal ¶
func SprintfRed ¶
func SprintfWarning ¶
func SprintfWhite ¶
func SprintfYellow ¶
Types ¶
type Environment ¶
type SelfUpdateArgs ¶
type SelfUpdateArgs struct {
// contains filtered or unexported fields
}
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) GetWarning ¶
func (*State) IsNotError ¶
func (*State) SetWarning ¶
type StringValue ¶
type StringValue string
func (*StringValue) IsEmpty ¶
func (v *StringValue) IsEmpty() bool
func (*StringValue) IsNil ¶
func (v *StringValue) IsNil() bool
func (*StringValue) IsNotEmpty ¶
func (v *StringValue) IsNotEmpty() bool
func (*StringValue) IsNotNil ¶
func (v *StringValue) IsNotNil() bool
func (*StringValue) IsNotValid ¶
func (v *StringValue) IsNotValid() bool
func (*StringValue) IsValid ¶
func (v *StringValue) IsValid() bool
func (*StringValue) String ¶
func (v *StringValue) String() string
type TargetFile ¶
type TargetFile struct { IsMissing bool IsRuntimeBinary bool FileMatches bool IsSymlink bool LinkTo string LinkEval string LinkToRuntime bool CopyOfRuntime bool Error error Info os.FileInfo }
func FileStat ¶
func FileStat(runtimeBinary string, targetBinary string) *TargetFile
type UrlValue ¶
type UrlValue struct { *url.URL Owner string Name string Version *VersionValue }
func (*UrlValue) GetShortUrl ¶
func (*UrlValue) IsNotEmpty ¶
func (*UrlValue) IsNotValid ¶
type Ux ¶
type Ux struct { }
func (*Ux) PrintError ¶
func (*Ux) PrintfBlue ¶
func (*Ux) PrintfCyan ¶
func (*Ux) PrintfDebug ¶
func (*Ux) PrintfError ¶
func (*Ux) PrintfGreen ¶
func (*Ux) PrintfInfo ¶
func (*Ux) PrintfMagenta ¶
func (*Ux) PrintfNormal ¶
func (*Ux) PrintfWarning ¶
func (*Ux) PrintfWhite ¶
func (*Ux) PrintfYellow ¶
func (*Ux) PrintflnBlue ¶
func (*Ux) PrintflnCyan ¶
func (*Ux) PrintflnError ¶
func (*Ux) PrintflnGreen ¶
func (*Ux) PrintflnInfo ¶
func (*Ux) PrintflnMagenta ¶
func (*Ux) PrintflnNormal ¶
func (*Ux) PrintflnOk ¶
func (*Ux) PrintflnRed ¶
func (*Ux) PrintflnWarning ¶
func (*Ux) PrintflnWhite ¶
func (*Ux) PrintflnYellow ¶
type Version ¶
type Version struct { ExecName string `json:"cmd_name" mapstructure:"cmd_name"` ExecVersion string `json:"cmd_version" mapstructure:"cmd_version"` ExecSourceRepo UrlValue `json:"cmd_source_repo" mapstructure:"cmd_source_repo"` ExecBinaryRepo UrlValue `json:"cmd_binary_repo" mapstructure:"cmd_binary_repo"` Cmd string `json:"cmd" mapstructure:"cmd"` CmdDir string `json:"cmd_dir" mapstructure:"cmd_dir"` CmdFile string `json:"cmd_file" mapstructure:"cmd_file"` WorkingDir *cmdPath.Path `json:"working_dir" mapstructure:"working_dir"` BaseDir *cmdPath.Path `json:"base_dir" mapstructure:"base_dir"` BinDir *cmdPath.Path `json:"bin_dir" mapstructure:"bin_dir"` ConfigDir *cmdPath.Path `json:"config_dir" mapstructure:"config_dir"` CacheDir *cmdPath.Path `json:"cache_dir" mapstructure:"cache_dir"` TempDir *cmdPath.Path `json:"temp_dir" mapstructure:"temp_dir"` FullArgs ExecArgs `json:"full_args" mapstructure:"full_args"` Args ExecArgs `json:"args" mapstructure:"args"` ArgFiles ExecArgs `json:"arg_files" mapstructure:"arg_files"` Env ExecEnv `json:"env" mapstructure:"env"` EnvMap Environment `json:"env_map" mapstructure:"env_map"` TimeStamp time.Time `json:"timestamp" mapstructure:"timestamp"` Timeout time.Duration `json:"timeout" mapstructure:"timeout"` GoRuntime GoRuntime `json:"go_runtime" mapstructure:"go_runtime"` User User `json:"user" mapstructure:"user"` Debug bool `json:"debug" mapstructure:"debug"` Verbose bool `json:"verbose" mapstructure:"verbose"` State State `json:"state" mapstructure:"state"` OldVersion *VersionValue TargetBinary string RuntimeBinary string AutoExec bool SelfCmd *cobra.Command // contains filtered or unexported fields }
func (*Version) AddFullArgs ¶
func (*Version) AttachCommands ¶
func (*Version) CmdVersionCheck ¶
func (*Version) CmdVersionInfo ¶
func (*Version) CmdVersionList ¶
func (*Version) CmdVersionShow ¶
func (*Version) CmdVersionUpdate ¶
func (*Version) CreateDummyBinary ¶
func (*Version) EnsureNotNil ¶
func (*Version) FetchVersion ¶
func (v *Version) FetchVersion(version *VersionValue) *selfupdate.Release
func (*Version) GetBinaryRepo ¶
func (*Version) GetEnvMap ¶
func (v *Version) GetEnvMap() *Environment
func (*Version) GetFullArgs ¶
func (*Version) GetSemVer ¶
func (v *Version) GetSemVer() *VersionValue
func (*Version) GetSourceRepo ¶
func (*Version) GetTimeout ¶
func (*Version) GetVersion ¶
func (*Version) GetVersionValue ¶
func (v *Version) GetVersionValue() *VersionValue
func (*Version) IsBootstrapBinary ¶
func (*Version) IsNotValid ¶
func (*Version) IsRunningAs ¶
func (*Version) IsRunningAsFile ¶
func (*Version) IsRunningAsLink ¶
func (*Version) PrintNameVersion ¶
func (v *Version) PrintNameVersion()
func (*Version) PrintSummary ¶
func (v *Version) PrintSummary(release *github.RepositoryRelease) State
func (*Version) PrintVersion ¶
func (v *Version) PrintVersion(version *VersionValue) State
func (*Version) PrintVersionSummary ¶
func (*Version) Set ¶
func (v *Version) Set(s SelfUpdateArgs) State
func (*Version) SetBinaryRepo ¶
func (*Version) SetFullArgs ¶
func (*Version) SetOldVersion ¶
func (*Version) SetSourceRepo ¶
func (*Version) SetVersion ¶
func (*Version) SprintfArgsFrom ¶
func (*Version) TimeStampEpoch ¶
func (*Version) TimeStampString ¶
func (*Version) UpdateTo ¶
func (v *Version) UpdateTo(newVersion *VersionValue) State
type VersionValue ¶
type VersionValue struct { semver.Version string }
func GetSemVer ¶
func GetSemVer(v string) *VersionValue
func (*VersionValue) IsLatest ¶
func (v *VersionValue) IsLatest() bool
func (*VersionValue) IsNotValid ¶
func (v *VersionValue) IsNotValid() bool
func (*VersionValue) IsValid ¶
func (v *VersionValue) IsValid() bool
func (*VersionValue) String ¶
func (v *VersionValue) String() string
func (*VersionValue) ToSemVer ¶
func (v *VersionValue) ToSemVer() semver.Version
Click to show internal directories.
Click to hide internal directories.