Skip to content

Commit

Permalink
Fix an issue where path prefix was presumed for variables
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Nov 14, 2024
1 parent 671d9d5 commit 3621929
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
6 changes: 5 additions & 1 deletion command/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,13 @@ var CommandUIRoutes = map[string]UIRoute{
Description: "View allocation details",
},
"var list": {
Path: "/variables/path/:prefix",
Path: "/variables",
Description: "View Nomad variables",
},
"var list prefix": {
Path: "/variables/path/:prefix",
Description: "View Nomad variables at this path",
},
"var get": {
Path: "/variables/var/:path@:namespace",
Description: "View variable details",
Expand Down
28 changes: 19 additions & 9 deletions command/var_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,25 @@ func (c *VarListCommand) Run(args []string) int {
c.Ui.Warn(fmt.Sprintf("Next page token: %s", qm.NextToken))
}

hint, _ := c.Meta.showUIPath(UIHintContext{
Command: "var list",
PathParams: map[string]string{
"prefix": prefix,
},
OpenURL: openURL,
})
if hint != "" {
c.Ui.Output(hint)
if prefix != "" {
hint, _ := c.Meta.showUIPath(UIHintContext{
Command: "var list prefix",
PathParams: map[string]string{
"prefix": prefix,
},
OpenURL: openURL,
})
if hint != "" {
c.Ui.Output(hint)
}
} else {
hint, _ := c.Meta.showUIPath(UIHintContext{
Command: "var list",
OpenURL: openURL,
})
if hint != "" {
c.Ui.Output(hint)
}
}

return 0
Expand Down

0 comments on commit 3621929

Please sign in to comment.