MCPcopy Create free account
hub / github.com/github/gh-aw / createField

Function createField

pkg/cli/project_command.go:542–565  ·  view source on GitHub ↗

createField creates a single field in the project

(ctx context.Context, projectNumber int, owner, name, dataType string, options []string, verbose bool)

Source from the content-addressed store, hash-verified

540
541// createField creates a single field in the project
542func createField(ctx context.Context, projectNumber int, owner, name, dataType string, options []string, verbose bool) error {
543 projectLog.Printf("Creating field: name=%s, type=%s", name, dataType)
544
545 args := []string{
546 "project", "field-create", strconv.Itoa(projectNumber),
547 "--owner", owner,
548 "--name", name,
549 "--data-type", dataType,
550 }
551
552 // Add options for SINGLE_SELECT fields
553 if dataType == "SINGLE_SELECT" && len(options) > 0 {
554 for _, option := range options {
555 args = append(args, "--single-select-options", option)
556 }
557 }
558
559 _, err := workflow.RunGH(fmt.Sprintf("Creating field %s...", name), args...)
560 if err != nil {
561 return fmt.Errorf("failed to create field: %w", err)
562 }
563
564 return nil
565}
566
567// ensureStatusOption ensures a status option exists in the project's Status field
568func ensureStatusOption(ctx context.Context, projectURL, optionName string, verbose bool) error {

Callers 1

createStandardFieldsFunction · 0.85

Calls 3

RunGHFunction · 0.92
PrintfMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected