Align trail create and phase handling with API · Entire

Align trail create and phase handling with API

1a6c8a5→main·

dipree·1mo ago·5 files·+199 added/-84 removed

Sessions

9a927e4dbff4View transcript

Changes

5

    // trailListServerMaxLimit is the most trails the server returns per
    // request (the list endpoint clamps limit to 200).
    trailListServerMaxLimit = 200
    trailFindMaxPages       = 100
)

func newTrailCmd() *cobra.Command {
var title, body, base, branch, status, phase string
var title, body, base, branch, status string
var checkout bool

cmd := &cobra.Command{
    Short: "Create a trail for the current or a new branch",
    Args:  cobra.NoArgs,
    RunE: func(cmd *cobra.Command, _ []string) error {
        return runTrailCreate(cmd, title, body, base, branch, status, phase, checkout)
        return runTrailCreate(cmd, title, body, base, branch, status, checkout)
    },
}

//nolint:cyclop // sequential steps for creating a trail — splitting would obscure the flow
func runTrailCreate(cmd *cobra.Command, title, body, base, branch, statusStr, phase string, checkout bool) error { ... }

func newTrailUpdateCmd() *cobra.Command {
var statusStr, title, body, branch, phase string
var statusStr, title, body, branch string
var labelAdd, labelRemove []string

cmd := &cobra.Command{
   TitleChanged:  cmd.Flags().Changed("title"),
   Body:          body,
   BodyChanged:   cmd.Flags().Changed("body"),
   Phase:         phase,
   PhaseChanged:  cmd.Flags().Changed("phase"),
   Branch:        branch,
   LabelAdd:      labelAdd,
   LabelRemove:   labelRemove,
}

// ... Additional cmd declarations ...

func findTrail(ctx context.Context, client *api.Client, forge, owner, repo string, match func(api.TrailResource) bool) (*api.TrailResource, error) { ... }

func trailsBasePath(forge, owner, repo string) string { ... }

Mcmd/entire/cli/trail_cmd.go+107/-67

// Function definitions, error handling, and other important logic here...

Command Definitions