(items []string, raw string)
| 2763 | } |
| 2764 | |
| 2765 | func missingWorkFromFlags(items []string, raw string) (json.RawMessage, error) { |
| 2766 | hasRaw := strings.TrimSpace(raw) != "" |
| 2767 | if hasRaw && len(items) > 0 { |
| 2768 | return nil, errors.New("cli: --missing-work-json cannot be combined with --missing-work") |
| 2769 | } |
| 2770 | if hasRaw { |
| 2771 | payload, err := parseJSONFlag("missing-work-json", raw) |
| 2772 | if err != nil { |
| 2773 | return nil, err |
| 2774 | } |
| 2775 | var items []json.RawMessage |
| 2776 | if err := json.Unmarshal(payload, &items); err != nil { |
| 2777 | return nil, errors.New("cli: --missing-work-json must be a JSON array") |
| 2778 | } |
| 2779 | return payload, nil |
| 2780 | } |
| 2781 | |
| 2782 | normalized := make([]string, 0, len(items)) |
| 2783 | for _, item := range items { |
| 2784 | trimmed := strings.TrimSpace(item) |
| 2785 | if trimmed != "" { |
| 2786 | normalized = append(normalized, trimmed) |
| 2787 | } |
| 2788 | } |
| 2789 | if len(normalized) == 0 { |
| 2790 | return nil, nil |
| 2791 | } |
| 2792 | payload, err := json.Marshal(normalized) |
| 2793 | if err != nil { |
| 2794 | return nil, fmt.Errorf("cli: encode --missing-work: %w", err) |
| 2795 | } |
| 2796 | return payload, nil |
| 2797 | } |
| 2798 | |
| 2799 | func resolveTaskScopeWorkspace( |
| 2800 | rawScope string, |
no test coverage detected