diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-08 20:12:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-08 20:12:38 +0100 |
commit | afd4d5f4a4b05f421e6f336b4d74a0d808be57ed (patch) | |
tree | 2ccb4a0bd9bda70c1c258dcb1b8aca8961d9ad30 /cmd/podman/cliconfig/commands.go | |
parent | 962850c6e0dfcee926af31fc0ad24f1f6c26f8ac (diff) | |
parent | 25a3923b61a5ca014318e6d957f68abd03947297 (diff) | |
download | podman-afd4d5f4a4b05f421e6f336b4d74a0d808be57ed.tar.gz podman-afd4d5f4a4b05f421e6f336b4d74a0d808be57ed.tar.bz2 podman-afd4d5f4a4b05f421e6f336b4d74a0d808be57ed.zip |
Merge pull request #2274 from baude/cobraprep
Migrate to cobra CLI
Diffstat (limited to 'cmd/podman/cliconfig/commands.go')
-rw-r--r-- | cmd/podman/cliconfig/commands.go | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/cmd/podman/cliconfig/commands.go b/cmd/podman/cliconfig/commands.go new file mode 100644 index 000000000..7d1e762d9 --- /dev/null +++ b/cmd/podman/cliconfig/commands.go @@ -0,0 +1,109 @@ +package cliconfig + +// GlobalIsSet is a compatibility method for urfave +func (p *PodmanCommand) GlobalIsSet(opt string) bool { + flag := p.PersistentFlags().Lookup(opt) + if flag == nil { + return false + } + return flag.Changed +} + +// IsSet is a compatibility method for urfave +func (p *PodmanCommand) IsSet(opt string) bool { + flag := p.Flags().Lookup(opt) + if flag == nil { + return false + } + return flag.Changed +} + +// Bool is a compatibility method for urfave +func (p *PodmanCommand) Bool(opt string) bool { + flag := p.Flags().Lookup(opt) + if flag == nil { + return false + } + val, _ := p.Flags().GetBool(opt) + return val +} + +// String is a compatibility method for urfave +func (p *PodmanCommand) String(opt string) string { + flag := p.Flags().Lookup(opt) + if flag == nil { + return "" + } + val, _ := p.Flags().GetString(opt) + return val +} + +// StringArray is a compatibility method for urfave +func (p *PodmanCommand) StringArray(opt string) []string { + flag := p.Flags().Lookup(opt) + if flag == nil { + return []string{} + } + val, _ := p.Flags().GetStringArray(opt) + return val +} + +// StringSlice is a compatibility method for urfave +func (p *PodmanCommand) StringSlice(opt string) []string { + flag := p.Flags().Lookup(opt) + if flag == nil { + return []string{} + } + val, _ := p.Flags().GetStringSlice(opt) + return val +} + +// Int is a compatibility method for urfave +func (p *PodmanCommand) Int(opt string) int { + flag := p.Flags().Lookup(opt) + if flag == nil { + return 0 + } + val, _ := p.Flags().GetInt(opt) + return val +} + +// Unt is a compatibility method for urfave +func (p *PodmanCommand) Uint(opt string) uint { + flag := p.Flags().Lookup(opt) + if flag == nil { + return 0 + } + val, _ := p.Flags().GetUint(opt) + return val +} + +// Int64 is a compatibility method for urfave +func (p *PodmanCommand) Int64(opt string) int64 { + flag := p.Flags().Lookup(opt) + if flag == nil { + return 0 + } + val, _ := p.Flags().GetInt64(opt) + return val +} + +// Unt64 is a compatibility method for urfave +func (p *PodmanCommand) Uint64(opt string) uint64 { + flag := p.Flags().Lookup(opt) + if flag == nil { + return 0 + } + val, _ := p.Flags().GetUint64(opt) + return val +} + +// Float64 is a compatibility method for urfave +func (p *PodmanCommand) Float64(opt string) float64 { + flag := p.Flags().Lookup(opt) + if flag == nil { + return 0 + } + val, _ := p.Flags().GetFloat64(opt) + return val +} |