-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: fix regression when injecting vars with cue cmd
The -t and -T flags can be used like: cue cmd -t foo=var -T mycmd . However, we also support a short form, where "cmd" can be omitted: cue -t foo=var -T mycmd . After the refactor in https://cuelang.org/cl/552733, we made cmd/cue more principled in how it handles the root command, and we broke those -t and -T flags in the "cue cmd" short form. We didn't intend to - they just started being treated as global flags. A simple and easy fix is to actually declare these flags globally, and not just as part of the "cue cmd" sub-command. Since each of these flags now exists in two levels, the only place where they are consumed, the setTags function, now checks both flag sets and joins their values. Note that we make the new global flags hidden, so that "cue help" doesn't start showing them as global flags. We don't really intend them as global flags for every command. We also avoid adding them to PersistentFlags, so that they are not inherited by sub-commands like fmt. This fix is preferrable to an entire revert of the previous CL, as otherwise commands like "cue help" would become very slow again. I've also filed #2519 to propose deprecating the "cue cmd" short form. Fixes #2510. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I254e1c4e8ef4d6ffa7d6142c75abee5f1a37a810 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/557127 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
- Loading branch information
Showing
9 changed files
with
42 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters