commands: check if flag is set instead of using flagutil.Tristate

Fixes --pull and --no-cache without argument

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass
2020-04-30 12:25:30 -07:00
parent 205165bec5
commit c4d07f67e3
3 changed files with 41 additions and 47 deletions

View File

@@ -1,36 +0,0 @@
package flagutil
import "strconv"
type tristate struct {
opt *bool
}
// Tristate is a tri-state boolean flag type.
// It can be set, but not unset.
func Tristate(opt *bool) tristate {
return tristate{opt}
}
func (t tristate) Type() string {
return "tristate"
}
func (t tristate) String() string {
if t.opt == nil {
return "(unset)"
}
if *t.opt {
return "true"
}
return "false"
}
func (t tristate) Set(s string) error {
b, err := strconv.ParseBool(s)
if err != nil {
return err
}
t.opt = &b
return nil
}