MCPcopy
hub / github.com/cli/cli / createRun

Function createRun

pkg/cmd/repo/autolink/create/create.go:93–118  ·  view source on GitHub ↗
(opts *createOptions)

Source from the content-addressed store, hash-verified

91}
92
93func createRun(opts *createOptions) error {
94 repo, err := opts.BaseRepo()
95 if err != nil {
96 return err
97 }
98
99 request := AutolinkCreateRequest{
100 KeyPrefix: opts.KeyPrefix,
101 URLTemplate: opts.URLTemplate,
102 IsAlphanumeric: !opts.Numeric,
103 }
104
105 autolink, err := opts.AutolinkClient.Create(repo, request)
106 if err != nil {
107 return fmt.Errorf("error creating autolink: %w", err)
108 }
109
110 cs := opts.IO.ColorScheme()
111 fmt.Fprintf(opts.IO.Out,
112 "%s Created repository autolink %s on %s\n",
113 cs.SuccessIconWithColor(cs.Green),
114 cs.Cyanf("%d", autolink.ID),
115 cs.Bold(ghrepo.FullName(repo)))
116
117 return nil
118}

Callers 2

TestCreateRunFunction · 0.70
NewCmdCreateFunction · 0.70

Calls 8

FullNameFunction · 0.92
ColorSchemeMethod · 0.80
SuccessIconWithColorMethod · 0.80
CyanfMethod · 0.80
BoldMethod · 0.80
BaseRepoMethod · 0.65
CreateMethod · 0.65
ErrorfMethod · 0.65

Tested by 1

TestCreateRunFunction · 0.56