(f factory.Factory)
| 51 | } |
| 52 | |
| 53 | func NewCmdCreate(f factory.Factory) *cobra.Command { |
| 54 | createFlags := NewNuPkgCreateFlags() |
| 55 | packFlags := pack.NewPackageCreateFlags() |
| 56 | |
| 57 | cmd := &cobra.Command{ |
| 58 | Use: "create", |
| 59 | Short: "Create nuget", |
| 60 | Long: "Create nuget package", |
| 61 | Example: heredoc.Docf(` |
| 62 | %[1]s package nuget create --id SomePackage --version 1.0.0 |
| 63 | `, constants.ExecutableName), |
| 64 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 65 | opts := &NuPkgCreateOptions{ |
| 66 | NuPkgCreateFlags: createFlags, |
| 67 | PackageCreateOptions: pack.NewPackageCreateOptions(f, packFlags, cmd), |
| 68 | } |
| 69 | return createRun(cmd, opts) |
| 70 | }, |
| 71 | } |
| 72 | |
| 73 | flags := cmd.Flags() |
| 74 | flags.StringVar(&packFlags.Id.Value, packFlags.Id.Name, "", "The ID of the package") |
| 75 | flags.StringVarP(&packFlags.Version.Value, packFlags.Version.Name, "v", "", "The version of the package, must be a valid SemVer.") |
| 76 | flags.StringVar(&packFlags.BasePath.Value, packFlags.BasePath.Name, "", "Root folder containing the contents to zip.") |
| 77 | flags.StringVar(&packFlags.OutFolder.Value, packFlags.OutFolder.Name, "", "Folder into which the zip file will be written.") |
| 78 | flags.StringSliceVar(&packFlags.Include.Value, packFlags.Include.Name, []string{}, "Add a file pattern to include, relative to the base path e.g. /bin/*.dll; defaults to \"**\".") |
| 79 | flags.BoolVar(&packFlags.Verbose.Value, packFlags.Verbose.Name, false, "Verbose output.") |
| 80 | flags.BoolVar(&packFlags.Overwrite.Value, packFlags.Overwrite.Name, false, "Allow an existing package file of the same ID/version to be overwritten.") |
| 81 | flags.StringSliceVar(&createFlags.Author.Value, createFlags.Author.Name, []string{}, "Add author/s to the package metadata.") |
| 82 | flags.StringVar(&createFlags.Title.Value, createFlags.Title.Name, "", "The title of the package.") |
| 83 | flags.StringVar(&createFlags.Description.Value, createFlags.Description.Name, "", "A description of the package, defaults to \"A deployment package created from files on disk.\".") |
| 84 | flags.StringVar(&createFlags.ReleaseNotes.Value, createFlags.ReleaseNotes.Name, "", "Release notes for this version of the package.") |
| 85 | flags.StringVar(&createFlags.ReleaseNotesFile.Value, createFlags.ReleaseNotesFile.Name, "", "A file containing release notes for this version of the package.") |
| 86 | flags.SortFlags = false |
| 87 | |
| 88 | return cmd |
| 89 | } |
| 90 | |
| 91 | func createRun(cmd *cobra.Command, opts *NuPkgCreateOptions) error { |
| 92 | outputFormat, err := cmd.Flags().GetString(constants.FlagOutputFormat) |
nothing calls this directly
no test coverage detected