(deps commandDeps)
| 817 | } |
| 818 | |
| 819 | func newTaskNotificationListCommand(deps commandDeps) *cobra.Command { |
| 820 | var ( |
| 821 | bridgeInstanceID string |
| 822 | scopeRaw string |
| 823 | workspaceID string |
| 824 | last int |
| 825 | ) |
| 826 | cmd := &cobra.Command{ |
| 827 | Use: "list <task-id>", |
| 828 | Short: "List bridge terminal notification subscriptions for one task", |
| 829 | Args: exactOneNonBlankArg(), |
| 830 | RunE: func(cmd *cobra.Command, args []string) error { |
| 831 | client, err := clientFromDeps(deps) |
| 832 | if err != nil { |
| 833 | return err |
| 834 | } |
| 835 | query, err := buildTaskBridgeNotificationSubscriptionListQuery( |
| 836 | bridgeInstanceID, |
| 837 | scopeRaw, |
| 838 | workspaceID, |
| 839 | last, |
| 840 | ) |
| 841 | if err != nil { |
| 842 | return err |
| 843 | } |
| 844 | subscriptions, err := client.ListTaskBridgeNotificationSubscriptions( |
| 845 | cmd.Context(), |
| 846 | args[0], |
| 847 | query, |
| 848 | ) |
| 849 | if err != nil { |
| 850 | return err |
| 851 | } |
| 852 | return writeCommandOutput( |
| 853 | cmd, |
| 854 | taskBridgeNotificationSubscriptionListBundle(subscriptions), |
| 855 | ) |
| 856 | }, |
| 857 | } |
| 858 | cmd.Flags().StringVar(&bridgeInstanceID, "bridge", "", "Filter by bridge instance ID") |
| 859 | cmd.Flags(). |
| 860 | StringVar(&scopeRaw, taskScopeKey, "", "Filter by bridge scope: global or workspace") |
| 861 | cmd.Flags().StringVar(&workspaceID, "workspace", "", "Filter by workspace ID") |
| 862 | cmd.Flags().IntVar(&last, "last", 0, "Show only the most recent N subscriptions") |
| 863 | return cmd |
| 864 | } |
| 865 | |
| 866 | func newTaskNotificationShowCommand(deps commandDeps) *cobra.Command { |
| 867 | return &cobra.Command{ |
no test coverage detected