...

Source file src/edge-infra.dev/pkg/tools/github/teamster/validate.go

Documentation: edge-infra.dev/pkg/tools/github/teamster

     1  package teamster
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"edge-infra.dev/pkg/lib/cli/sink"
     8  	"edge-infra.dev/pkg/tools/github/ghx"
     9  )
    10  
    11  func NewCmdValidate() *sink.Command {
    12  	var (
    13  		ref, repo, org string
    14  		gh             = &ghx.GHX{}
    15  	)
    16  
    17  	cmd := &sink.Command{
    18  		Use:        "validate [flags] <teams file>",
    19  		Short:      "Validate team configuration files",
    20  		Flags:      commonFlags(&org, &repo, &ref),
    21  		Extensions: []sink.Extension{gh},
    22  		Exec: func(ctx context.Context, r sink.Run) error {
    23  			if len(r.Args()) < 1 {
    24  				return fmt.Errorf("path to teams file is required")
    25  			}
    26  
    27  			_, err := getTeam(ctx, r.Args()[0], org, repo, ref, gh.V3)
    28  			return err
    29  		},
    30  	}
    31  
    32  	return cmd
    33  }
    34  

View as plain text