cue
cue copied to clipboard
cmd/cue: remove support for the deprecated short form of "cue cmd" in v0.11
We already have https://github.com/cue-lang/cue/issues/1325 as a rethink and redesign for cue cmd. Before that happens, and while we still support the existing cue cmd, I think we should deprecate and later remove support for the "short form" or shortcut that is using cue foo instead of cue cmd foo.
In https://github.com/cue-lang/cue/issues/1325#issuecomment-1484211334 I raised some arguments in favor of this, and I believe others like @jpluscplusm and @myitcv share similar feelings.
The implementation of cmd/cue is also made significantly more complex due to this; for example, see https://review.gerrithub.io/c/cue-lang/cue/+/557127. It's not just that there's more code to maintain, but it's very tricky to properly implement these cue cmd shortcuts as they are effectively a fallback sub-command which requires loading a CUE package first, to discover which commands exist in *_tool.cue files.
The added complexity in cmd/cue also caused a number of bugs in the past:
- https://github.com/cue-lang/cue/issues/2161 - commands like
cue helpdid too much work, loading CUE packages - https://github.com/cue-lang/cue/issues/1694 - the tests were chatty, since we were parsing flags before the command output writers could be configured
Intuitively, it's also somewhat confusing that cue -t foo=bar foo works (injecting a tag to a command), but cue -t foo=bar fmt does not work, since -t is not actually a global flag even though it looks like one.
I propose that we start showing a deprecation warning when someone calls cue foo in v0.7.0, asking them to use cue cmd foo instead, and in v0.8.0 we can entirely remove support for the short form. With v0.7.0, we should also update our documentation and guides so that we don't encourage the use of the short form anywhere.
For example, in v0.7.0:
$ cue -t foo=bar foo
warning: the "cue cmd" abbreviation is deprecated in v0.7, and will be removed in v0.8. instead, use:
cue cmd -t foo=bar foo
I support the short, non-cmd invocation's removal.
Separately: whilst CUE doesn't have 30 years of precedence-creating history to think about, it might be worth keeping in mind the kerfuffle that adding obsolescence/deprecation warnings to the stderr of egrep (and siblings) created relatively recently: https://unix.stackexchange.com/a/727773.
Is a cue_tool that prints to stderr only in exceptional cases a use case that's currently possible?
The deprecation didn't happen for v0.7, but starting it now for v0.9.
Aiming to remove support for the deprecated form in the first v0.11 alpha; the v0.9 and v0.10 release cycles will be short, around three months, so deprecation for one release cycle is a bit tight.