66
77 "github.com/spf13/cobra"
88 "github.com/stackvista/stackstate-cli/generated/stackstate_api"
9- stscobra "github.com/stackvista/stackstate-cli/internal/cobra"
109 "github.com/stackvista/stackstate-cli/internal/common"
1110 "github.com/stackvista/stackstate-cli/internal/di"
1211 "github.com/stackvista/stackstate-cli/internal/printer"
@@ -17,7 +16,6 @@ type StateArgs struct {
1716 Tags []string
1817 Identifiers []string
1918 Limit int
20- STQL string
2119}
2220
2321func StateCommand (cli * di.Deps ) * cobra.Command {
@@ -45,10 +43,7 @@ sts topology state --type "otel service instance" --identifier "urn:opentelemetr
4543sts topology state --type "otel service instance" --limit 10
4644
4745# show state and display as JSON
48- sts topology state --type "otel service instance" -o json
49-
50- # show state using a custom STQL query
51- sts topology state --stql 'type = "otel service instance" AND healthState = "CRITICAL"'` ,
46+ sts topology state --type "otel service instance" -o json` ,
5247 RunE : cli .CmdRunEWithApi (func (cmd * cobra.Command , cli * di.Deps , api * stackstate_api.APIClient , serverInfo * stackstate_api.ServerInfo ) common.CLIError {
5348 return RunStateCommand (cmd , cli , api , serverInfo , args )
5449 }),
@@ -58,8 +53,6 @@ sts topology state --stql 'type = "otel service instance" AND healthState = "CRI
5853 cmd .Flags ().StringSliceVar (& args .Tags , "tag" , []string {}, "Filter by tags in format 'tag-name:tag-value' (multiple allowed, ANDed together)" )
5954 cmd .Flags ().StringSliceVar (& args .Identifiers , "identifier" , []string {}, "Filter by component identifiers (multiple allowed, ANDed together)" )
6055 cmd .Flags ().IntVar (& args .Limit , "limit" , 0 , "Maximum number of components to output (must be positive)" )
61- cmd .Flags ().StringVar (& args .STQL , "stql" , "" , "STQL query to select components (mutually exclusive with --type, --tag, --identifier)" )
62- stscobra .MarkMutexFlags (cmd , []string {"type" , "stql" }, "query" , true )
6356
6457 return cmd
6558}
@@ -75,12 +68,7 @@ func RunStateCommand(
7568 return common .NewExecutionError (fmt .Errorf ("limit must be a positive number, got: %d" , args .Limit ))
7669 }
7770
78- var query string
79- if args .STQL != "" {
80- query = args .STQL
81- } else {
82- query = buildSTQLQuery (args .ComponentType , args .Tags , args .Identifiers )
83- }
71+ query := buildSTQLQuery (args .ComponentType , args .Tags , args .Identifiers )
8472
8573 metadata := stackstate_api .NewQueryMetadata (
8674 false ,
0 commit comments