-
Notifications
You must be signed in to change notification settings - Fork 11
Add support for variables #305
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some minor comments. Can you also add the bash completion for variables to this PR? Otherwise it might be forgotten.
cmd/variable.go
Outdated
Args: cobra.ExactArgs(1), | ||
Short: "Evaluate the layout of an generic variable", | ||
Long: "Evaluate the layout of an generic variable", | ||
Example: "corectl variable layout DIMENSION-ID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VARIABLE-ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops
@@ -60,7 +60,7 @@ var listDimensionsCmd = &cobra.Command{ | |||
Run: func(ccmd *cobra.Command, args []string) { | |||
state := internal.PrepareEngineState(rootCtx, headers, false) | |||
items := internal.ListDimensions(state.Ctx, state.Doc) | |||
printer.PrintNamedItemsList(items, viper.GetBool("bash")) | |||
printer.PrintNamedItemsList(items, viper.GetBool("bash"), false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we only want to print the title for variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the bash-flag yes, since we can only retrieve variables by name. Normally the print for bash completion only prints IDs so it had to be modified to support this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
This PR contains commands to manage variables. It seems that there are two types of variables: Variables and GenericVariables. As we want to use GenericVariables - I am assuming - we have to use the method GetVariableByName as it is the only getter that returns said type.
Tests (golden even) pass, don't seem to have the same problems as bookmarks.
Closes #298