MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / createRun

Function createRun

pkg/cmd/package/nuget/create/create.go:91–166  ·  view source on GitHub ↗
(cmd *cobra.Command, opts *NuPkgCreateOptions)

Source from the content-addressed store, hash-verified

89}
90
91func createRun(cmd *cobra.Command, opts *NuPkgCreateOptions) error {
92 outputFormat, err := cmd.Flags().GetString(constants.FlagOutputFormat)
93 if err != nil { // should never happen, but fallback if it does
94 outputFormat = constants.OutputFormatTable
95 }
96 if !opts.NoPrompt {
97 if err := pack.PackageCreatePromptMissing(opts.PackageCreateOptions); err != nil {
98 return err
99 }
100 if err := PromptMissing(opts); err != nil {
101 return err
102 }
103 }
104
105 if opts.Id.Value == "" {
106 return errors.New("must supply a package ID")
107 }
108
109 err = applyDefaultsToUnspecifiedPackageOptions(opts)
110 if err != nil {
111 return err
112 }
113
114 nuspecFilePath := ""
115 if shouldGenerateNuSpec(opts) {
116 defer func() {
117 if nuspecFilePath != "" {
118 err := os.Remove(nuspecFilePath)
119 if err != nil {
120 panic(err)
121 }
122 }
123 }()
124 nuspecFilePath, err = GenerateNuSpec(opts)
125 if err != nil {
126 return err
127 }
128 opts.Include.Value = append(opts.Include.Value, opts.Id.Value+".nuspec")
129 }
130
131 pack.VerboseOut(opts.Writer, opts.Verbose.Value, "Packing \"%s\" version \"%s\"...\n", opts.Id.Value, opts.Version.Value)
132 outFilePath := pack.BuildOutFileName("nupkg", opts.Id.Value, opts.Version.Value)
133
134 if !opts.NoPrompt {
135 autoCmd := flag.GenerateAutomationCmd(
136 opts.CmdPath, "",
137 opts.Author,
138 opts.Title,
139 opts.Description,
140 opts.ReleaseNotes,
141 opts.ReleaseNotesFile,
142 opts.Id,
143 opts.Version,
144 opts.BasePath,
145 opts.OutFolder,
146 opts.Include,
147 opts.Verbose,
148 opts.Overwrite,

Callers 1

NewCmdCreateFunction · 0.70

Calls 5

GenerateAutomationCmdFunction · 0.92
shouldGenerateNuSpecFunction · 0.85
GenerateNuSpecFunction · 0.85
PromptMissingFunction · 0.70

Tested by

no test coverage detected