Replace flag text with const (#1391)
This commit is contained in:
@@ -30,9 +30,9 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(View),
|
||||
}
|
||||
wrapper.SetFlags(viewCmd, flag.FlagSet{
|
||||
Optional: []flag.Flag{flag.RecordsFilterTimeToFlag, flag.RecordsFilterTimeFromFlag,
|
||||
flag.RecordsFilterFunctionFlag, flag.RecordsFilterTriggerFlag, flag.RecordsVerbosityFlag,
|
||||
flag.RecordsVvFlag},
|
||||
Optional: []flag.Flag{flag.RecordsFilterTimeTo, flag.RecordsFilterTimeFrom,
|
||||
flag.RecordsFilterFunction, flag.RecordsFilterTrigger, flag.RecordsVerbosity,
|
||||
flag.RecordsVv},
|
||||
})
|
||||
|
||||
command := &cobra.Command{
|
||||
|
||||
@@ -33,37 +33,37 @@ type ViewSubCommand struct {
|
||||
client *client.Client
|
||||
}
|
||||
|
||||
func View(flags cli.Input) error {
|
||||
c, err := util.GetServer(flags)
|
||||
func View(flaginput cli.Input) error {
|
||||
c, err := util.GetServer(flaginput)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
opts := ViewSubCommand{
|
||||
client: c,
|
||||
}
|
||||
return opts.do(flags)
|
||||
return opts.do(flaginput)
|
||||
}
|
||||
|
||||
func (opts *ViewSubCommand) do(flags cli.Input) error {
|
||||
return opts.run(flags)
|
||||
func (opts *ViewSubCommand) do(input cli.Input) error {
|
||||
return opts.run(input)
|
||||
}
|
||||
|
||||
func (opts *ViewSubCommand) run(flags cli.Input) error {
|
||||
func (opts *ViewSubCommand) run(input cli.Input) error {
|
||||
var verbosity int
|
||||
if flags.Bool("v") && flags.Bool("vv") {
|
||||
if input.Bool("v") && input.Bool("vv") {
|
||||
return errors.New("conflicting verbosity levels, use either --v or --vv")
|
||||
}
|
||||
if flags.Bool("v") {
|
||||
if input.Bool("v") {
|
||||
verbosity = 1
|
||||
}
|
||||
if flags.Bool("vv") {
|
||||
if input.Bool("vv") {
|
||||
verbosity = 2
|
||||
}
|
||||
|
||||
function := flags.String("function")
|
||||
trigger := flags.String("trigger")
|
||||
from := flags.String("from")
|
||||
to := flags.String("to")
|
||||
function := input.String("function")
|
||||
trigger := input.String("trigger")
|
||||
from := input.String("from")
|
||||
to := input.String("to")
|
||||
|
||||
//Refuse multiple filters for now
|
||||
if multipleFiltersSpecified(function, trigger, from+to) {
|
||||
|
||||
Reference in New Issue
Block a user