(deps commandDeps)
| 503 | } |
| 504 | |
| 505 | func newBridgeTargetsCommand(deps commandDeps) *cobra.Command { |
| 506 | var query string |
| 507 | var limit int |
| 508 | cmd := &cobra.Command{ |
| 509 | Use: "targets <id>", |
| 510 | Short: "List discovered targets for one bridge instance", |
| 511 | Args: exactOneNonBlankArg(), |
| 512 | RunE: func(cmd *cobra.Command, args []string) error { |
| 513 | if limit < 0 { |
| 514 | return errors.New("cli: --limit cannot be negative") |
| 515 | } |
| 516 | client, err := clientFromDeps(deps) |
| 517 | if err != nil { |
| 518 | return err |
| 519 | } |
| 520 | result, err := client.BridgeTargets(cmd.Context(), args[0], query, limit) |
| 521 | if err != nil { |
| 522 | return err |
| 523 | } |
| 524 | return writeCommandOutput(cmd, bridgeTargetsBundle(result, deps.now)) |
| 525 | }, |
| 526 | } |
| 527 | cmd.Flags(). |
| 528 | StringVarP(&query, "query", "q", "", "Filter targets by display name, qualifier, or route") |
| 529 | cmd.Flags().IntVar(&limit, "limit", 0, "Maximum targets to return") |
| 530 | return cmd |
| 531 | } |
| 532 | |
| 533 | func newBridgeResolveCommand(deps commandDeps) *cobra.Command { |
| 534 | return &cobra.Command{ |
no test coverage detected