| 91 | } |
| 92 | |
| 93 | func 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 | } |