this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue: drop --verbose and --trace as global flags

The former is only used by `get go` and the latter by `trim`.
While having them as global flags is not actively causing bugs,
it is taking up valuable space in e.g. `cue help vet`,
and it's also causing confusion as users expect these flags
to do something useful for most commands.

In practice, we should have almost zero global flags,
given that it's very hard for one flag to apply to vastly different
subcommands like `mod edit`, `fmt`, `export`, `login`, etc.

This is technically a breaking change, as these flags used to work
as no-ops for all commands, and will now fail as unknown flags for most.
Arguably that's a reasonable kind of breakage; users of those flags
thought they were getting behavior which was a lie.

If they actually want that behavior, they can reach out to us
or raise an issue and we can discuss re-adding the flag for commands
where it can actually do something useful.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I0230b73149a01b8cecdb9dcf14e40bbda1fac022
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1230085
Reviewed-by: Matthew Sackman <matthew@cue.works>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+7 -13
-4
cmd/cue/cmd/flags.go
··· 82 82 } 83 83 84 84 func addGlobalFlags(f *pflag.FlagSet) { 85 - f.Bool(string(flagTrace), false, 86 - "trace computation") 87 85 f.BoolP(string(flagSimplify), "s", false, 88 86 "simplify output") 89 87 f.BoolP(string(flagIgnore), "i", false, 90 88 "proceed in the presence of errors") 91 - f.BoolP(string(flagVerbose), "v", false, 92 - "print information about progress") 93 89 f.BoolP(string(flagAllErrors), "E", false, "print all available errors") 94 90 95 91 f.String(string(flagCpuProfile), "", "write a CPU profile to the specified file before exiting")
+3
cmd/cue/cmd/get_go.go
··· 212 212 RunE: mkRunE(c, extract), 213 213 } 214 214 215 + cmd.Flags().BoolP(string(flagVerbose), "v", false, 216 + "print information about progress") 217 + 215 218 cmd.Flags().StringP(string(flagExclude), "e", "", 216 219 "comma-separated list of regexps of identifiers to omit") 217 220
-4
cmd/cue/cmd/testdata/script/help_cmd.txtar
··· 175 175 -E, --all-errors print all available errors 176 176 -i, --ignore proceed in the presence of errors 177 177 -s, --simplify simplify output 178 - --trace trace computation 179 - -v, --verbose print information about progress 180 178 181 179 Use "cue cmd [command] --help" for more information about a command. 182 180 -- cue-help-cmd-hello.stdout -- ··· 189 187 -E, --all-errors print all available errors 190 188 -i, --ignore proceed in the presence of errors 191 189 -s, --simplify simplify output 192 - --trace trace computation 193 - -v, --verbose print information about progress
-2
cmd/cue/cmd/testdata/script/help_cmd_flags.txtar
··· 145 145 -E, --all-errors print all available errors 146 146 -i, --ignore proceed in the presence of errors 147 147 -s, --simplify simplify output 148 - --trace trace computation 149 - -v, --verbose print information about progress
+3 -3
cmd/cue/cmd/testdata/script/unknown_args.txtar
··· 22 22 ! stdout . 23 23 cmp stderr unknown_mod_cmd.out 24 24 25 - ! exec cue -v mod -E unknown --unknown 25 + ! exec cue -i mod -E unknown --unknown 26 26 ! stdout . 27 27 cmp stderr unknown_mod_cmd.out 28 28 29 29 # A rather convoluted edge case, but Cobra allows mixing flags with args, 30 - # even when the args are subcommand names. -v and -E are global flags. 30 + # even when the args are subcommand names. -i and -E are global flags. 31 31 # TODO: this should result in an "unknown subcommand" error. 32 - ! exec cue -v mod -E unknown --unknown 32 + ! exec cue -i mod -E unknown --unknown 33 33 ! stdout . 34 34 cmp stderr unknown_mod_cmd.out 35 35
+1
cmd/cue/cmd/trim.go
··· 87 87 } 88 88 89 89 addOutFlags(cmd.Flags(), false) 90 + cmd.Flags().Bool(string(flagTrace), false, "trace computation") 90 91 cmd.Flags().BoolP(string(flagDryRun), "n", false, "only run simulation") 91 92 92 93 return cmd