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

Function NewCmdCreate

pkg/cmd/package/zip/create/create.go:16–43  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

14)
15
16func NewCmdCreate(f factory.Factory) *cobra.Command {
17 createFlags := pack.NewPackageCreateFlags()
18
19 cmd := &cobra.Command{
20 Use: "create",
21 Short: "Create zip",
22 Long: "Create zip package",
23 Example: heredoc.Docf(`
24 %[1]s package zip create --id SomePackage --version 1.0.0
25 `, constants.ExecutableName),
26 RunE: func(cmd *cobra.Command, args []string) error {
27 opts := pack.NewPackageCreateOptions(f, createFlags, cmd)
28 return createRun(cmd, opts)
29 },
30 }
31
32 flags := cmd.Flags()
33 flags.StringVar(&createFlags.Id.Value, createFlags.Id.Name, "", "The ID of the package.")
34 flags.StringVarP(&createFlags.Version.Value, createFlags.Version.Name, "v", "", "The version of the package, must be a valid SemVer.")
35 flags.StringVar(&createFlags.BasePath.Value, createFlags.BasePath.Name, "", "Root folder containing the contents to zip.")
36 flags.StringVar(&createFlags.OutFolder.Value, createFlags.OutFolder.Name, "", "Folder into which the zip file will be written.")
37 flags.StringSliceVar(&createFlags.Include.Value, createFlags.Include.Name, []string{}, "Add a file pattern to include, relative to the base path e.g. /bin/*.dll; defaults to \"**\".")
38 flags.BoolVar(&createFlags.Verbose.Value, createFlags.Verbose.Name, false, "Verbose output.")
39 flags.BoolVar(&createFlags.Overwrite.Value, createFlags.Overwrite.Name, false, "Allow an existing package file of the same ID/version to be overwritten.")
40 flags.SortFlags = false
41
42 return cmd
43}
44
45func createRun(cmd *cobra.Command, opts *pack.PackageCreateOptions) error {
46 outputFormat, err := cmd.Flags().GetString(constants.FlagOutputFormat)

Callers

nothing calls this directly

Calls 1

createRunFunction · 0.70

Tested by

no test coverage detected