cmd/cue: add -C flag, like `go` and `git`
cmd/cue gains a -C flag that changes the working directory before any
other processing. -C must be the first argument and accepts either
"-C dir" or "-C=dir". This mirrors the flag added to cmd/go in
https://go.dev/cl/421436, and follows the same constraint that -C must
precede the subcommand.
Note that other tools like `git` allow the -C flag to come after other
flags even though it affects all flags, and even multiple -C flags.
We don't support these for now as they seem unnecessary.
Fixes #1918
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I4ee255d08ea507bd771481af6932b0ebb34e3b6b
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1236314
Reviewed-by: Paul Jolly <paul@myitcv.io>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>