MCPcopy Index your code
hub / github.com/cli/cli / createFieldArgs

Function createFieldArgs

pkg/cmd/project/field-create/field_create.go:122–143  ·  view source on GitHub ↗
(config createFieldConfig)

Source from the content-addressed store, hash-verified

120}
121
122func createFieldArgs(config createFieldConfig) (*createProjectV2FieldMutation, map[string]interface{}) {
123 input := githubv4.CreateProjectV2FieldInput{
124 ProjectID: githubv4.ID(config.opts.projectID),
125 DataType: githubv4.ProjectV2CustomFieldType(config.opts.dataType),
126 Name: githubv4.String(config.opts.name),
127 }
128
129 if len(config.opts.singleSelectOptions) != 0 {
130 opts := make([]githubv4.ProjectV2SingleSelectFieldOptionInput, 0)
131 for _, opt := range config.opts.singleSelectOptions {
132 opts = append(opts, githubv4.ProjectV2SingleSelectFieldOptionInput{
133 Name: githubv4.String(opt),
134 Color: githubv4.ProjectV2SingleSelectFieldOptionColor("GRAY"),
135 })
136 }
137 input.SingleSelectOptions = &opts
138 }
139
140 return &createProjectV2FieldMutation{}, map[string]interface{}{
141 "input": input,
142 }
143}
144
145func printResults(config createFieldConfig, field queries.ProjectField) error {
146 if !config.io.IsStdoutTTY() {

Callers 1

runCreateFieldFunction · 0.85

Calls 2

IDMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected