MCPcopy Create free account
hub / github.com/compozy/agh / newBridgeTargetsCommand

Function newBridgeTargetsCommand

internal/cli/bridge.go:505–531  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

503}
504
505func 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
533func newBridgeResolveCommand(deps commandDeps) *cobra.Command {
534 return &cobra.Command{

Callers 1

newBridgeCommandFunction · 0.85

Calls 5

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
bridgeTargetsBundleFunction · 0.85
BridgeTargetsMethod · 0.65

Tested by

no test coverage detected