Skip to content

Commit aeec602

Browse files
committed
[coconut] Improve role query command documentation
1 parent 2d35bd2 commit aeec602

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

coconut/cmd/role_query.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,26 @@ var roleQueryCmd = &cobra.Command{
3434
Use: "query [environment id] [query path]",
3535
Aliases: []string{"query", "q"},
3636
Short: "query O² roles",
37-
Long: `The role query command returns one or more role trees.`,
38-
Run: control.WrapCall(control.QueryRoles),
39-
Args: cobra.ExactArgs(2),
37+
Long: `The role query command returns one or more role subtrees within a given environment.
38+
39+
It allows the user to inspect the environment's workflow at runtime, after template processing operations, including
40+
iterator expansion, just-in-time subworkflow inclusion, and variable substitution, have taken place.
41+
42+
For the target role or roles, it also prints the locally defined variables, as well as the consolidated variable
43+
stack from the point of view of that role.
44+
45+
The role query command accepts two arguments: the environment ID and the query path. The query path is a dot-separated
46+
walk through the role tree of the given environment, starting from the root role. Wildcard expressions are allowed, as
47+
per https://github.com/gobwas/glob syntax.
48+
49+
Examples:
50+
* ` + "`coconut role query 2rE9AV3m1HL readout-dataflow`" + ` - queries the role ` + "`readout-dataflow`" + ` in environment ` + "`2rE9AV3m1HL`" + `, prints the full tree, along with the variables defined in the root role
51+
* ` + "`coconut role query 2rE9AV3m1HL readout-dataflow.host-aido2-bld4-lab102`" + ` - queries the role ` + "`readout-dataflow.host-aido2-bld4-lab102`" + `, prints the subtree of that role, along with the variables defined in it
52+
* ` + "`coconut role query 2rE9AV3m1HL readout-dataflow.host-aido2-bld4-lab102.data-distribution.stfs`" + ` - queries the role at the given path, it is a task role so there is no subtree, prints the variables defined in that role
53+
* ` + "`coconut role query 2rE9AV3m1HL readout-dataflow.host-aido2-bld4-lab*`" + ` - queries the roles matching the given glob expression, prints all the subtrees and variables
54+
* ` + "`coconut role query 2rE9AV3m1HL readout-dataflow.host-aido2-bld4-lab*.data-distribution.*`" + ` - queries the task roles matching the given glob expression, prints all the variables`,
55+
Run: control.WrapCall(control.QueryRoles),
56+
Args: cobra.ExactArgs(2),
4057
}
4158

4259
func init() {

0 commit comments

Comments
 (0)