Replace flag text with const (#1391)

This commit is contained in:
Ta-Ching Chen
2019-11-09 22:13:35 +08:00
committed by GitHub
parent 6f5f6900b6
commit d3d8ff6c1b
73 changed files with 867 additions and 926 deletions
+13 -13
View File
@@ -34,33 +34,33 @@ type UpdateSubCommand struct {
recorder *fv1.Recorder
}
func Update(flags cli.Input) error {
c, err := util.GetServer(flags)
func Update(input cli.Input) error {
c, err := util.GetServer(input)
if err != nil {
return err
}
opts := UpdateSubCommand{
client: c,
}
return opts.do(flags)
return opts.do(input)
}
func (opts *UpdateSubCommand) do(flags cli.Input) error {
err := opts.complete(flags)
func (opts *UpdateSubCommand) do(input cli.Input) error {
err := opts.complete(input)
if err != nil {
return err
}
return opts.run(flags)
return opts.run(input)
}
func (opts *UpdateSubCommand) complete(flags cli.Input) error {
recName := flags.String("name")
enable := flags.Bool("enable")
disable := flags.Bool("disable")
func (opts *UpdateSubCommand) complete(input cli.Input) error {
recName := input.String("name")
enable := input.Bool("enable")
disable := input.Bool("disable")
//retPolicy := flags.String("retention")
//evictPolicy := flags.String("eviction")
triggers := flags.StringSlice("trigger")
function := flags.String("function")
triggers := input.StringSlice("trigger")
function := input.String("function")
if enable && disable {
return errors.New("Cannot enable and disable a recorder simultaneously.")
@@ -134,7 +134,7 @@ func (opts *UpdateSubCommand) complete(flags cli.Input) error {
return nil
}
func (opts *UpdateSubCommand) run(flags cli.Input) error {
func (opts *UpdateSubCommand) run(input cli.Input) error {
_, err := opts.client.RecorderUpdate(opts.recorder)
if err != nil {
return errors.Wrap(err, "error updating recorder")