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

Function newNetworkSubscriptionModeCommand

internal/cli/network.go:1024–1063  ·  view source on GitHub ↗
(
	deps commandDeps,
	workspaceRef *string,
	use string,
	mode string,
	short string,
)

Source from the content-addressed store, hash-verified

1022}
1023
1024func newNetworkSubscriptionModeCommand(
1025 deps commandDeps,
1026 workspaceRef *string,
1027 use string,
1028 mode string,
1029 short string,
1030) *cobra.Command {
1031 var flags networkSubscriptionFlags
1032 cmd := &cobra.Command{
1033 Use: use,
1034 Short: short,
1035 RunE: func(cmd *cobra.Command, _ []string) error {
1036 client, err := clientFromDeps(deps)
1037 if err != nil {
1038 return err
1039 }
1040 workspace, err := resolveNetworkWorkspaceRef(cmd, deps, client, workspaceRef)
1041 if err != nil {
1042 return err
1043 }
1044 subscription, err := client.SetNetworkSubscription(
1045 cmd.Context(),
1046 workspace,
1047 strings.TrimSpace(flags.channel),
1048 NetworkSubscriptionRequest{
1049 ThreadID: strings.TrimSpace(flags.threadID),
1050 PeerID: strings.TrimSpace(flags.peerID),
1051 Mode: mode,
1052 KeywordFilters: trimSpawnAtoms(flags.keywordFilters),
1053 },
1054 )
1055 if err != nil {
1056 return err
1057 }
1058 return writeCommandOutput(cmd, networkSubscriptionBundle(subscription))
1059 },
1060 }
1061 registerNetworkSubscriptionMutationFlags(cmd, &flags, true)
1062 return cmd
1063}
1064
1065func newNetworkUnmuteCommand(deps commandDeps, workspaceRef *string) *cobra.Command {
1066 var flags networkSubscriptionFlags

Callers 1

newNetworkCommandFunction · 0.85

Calls 7

clientFromDepsFunction · 0.85
trimSpawnAtomsFunction · 0.85
writeCommandOutputFunction · 0.85

Tested by

no test coverage detected