(cmd *cobra.Command, opts *NuPkgCreateOptions)
| 89 | } |
| 90 | |
| 91 | func 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, |
no test coverage detected