From: Peymaneh Date: Mon, 2 Jan 2023 21:33:36 +0100 Subject: Remove obsolote subcommands forwarded: not-needed --- cmd/commands.go | 76 +++++++++++---------------------------------------------- 1 file changed, 14 insertions(+), 62 deletions(-) --- a/cmd/commands.go +++ b/cmd/commands.go @@ -405,51 +405,6 @@ }, }) - RegisterCommand(Command{ - Name: "upgrade", - Short: "Upgrade Caddy (EXPERIMENTAL)", - Long: ` -Downloads an updated Caddy binary with the same modules/plugins at the -latest versions. EXPERIMENTAL: May be changed or removed. -`, - CobraFunc: func(cmd *cobra.Command) { - cmd.Flags().BoolP("keep-backup", "k", false, "Keep the backed up binary, instead of deleting it") - cmd.RunE = WrapCommandFuncForCobra(cmdUpgrade) - }, - }) - - RegisterCommand(Command{ - Name: "add-package", - Usage: "", - Short: "Adds Caddy packages (EXPERIMENTAL)", - Long: ` -Downloads an updated Caddy binary with the specified packages (module/plugin) -added, with an optional version specified (e.g., "package@version"). Retains -existing packages. Returns an error if any of the specified packages are already -included. EXPERIMENTAL: May be changed or removed. -`, - CobraFunc: func(cmd *cobra.Command) { - cmd.Flags().BoolP("keep-backup", "k", false, "Keep the backed up binary, instead of deleting it") - cmd.RunE = WrapCommandFuncForCobra(cmdAddPackage) - }, - }) - - RegisterCommand(Command{ - Name: "remove-package", - Func: cmdRemovePackage, - Usage: "", - Short: "Removes Caddy packages (EXPERIMENTAL)", - Long: ` -Downloads an updated Caddy binaries without the specified packages (module/plugin). -Returns an error if any of the packages are not included. -EXPERIMENTAL: May be changed or removed. -`, - CobraFunc: func(cmd *cobra.Command) { - cmd.Flags().BoolP("keep-backup", "k", false, "Keep the backed up binary, instead of deleting it") - cmd.RunE = WrapCommandFuncForCobra(cmdRemovePackage) - }, - }) - defaultFactory.Use(func(rootCmd *cobra.Command) { manpageCommand := Command{ Name: "manpage", --- a/cmd/commands_test.go +++ b/cmd/commands_test.go @@ -15,22 +15,22 @@ t.Fatal("default factory failed to build") } - // check that the default factory has 17 commands; it doesn't + // check that the default factory has 14 commands; it doesn't // include the commands registered through calls to init in // other packages cmds := Commands() - if len(cmds) != 17 { - t.Errorf("expected 17 commands, got %d", len(cmds)) + if len(cmds) != 14 { + t.Errorf("expected 14 commands, got %d", len(cmds)) } commandNames := slices.Collect(maps.Keys(cmds)) slices.Sort(commandNames) expectedCommandNames := []string{ - "adapt", "add-package", "build-info", "completion", + "adapt", "build-info", "completion", "environ", "fmt", "list-modules", "manpage", - "reload", "remove-package", "run", "start", - "stop", "storage", "upgrade", "validate", "version", + "reload", "run", "start", + "stop", "storage", "validate", "version", } if !reflect.DeepEqual(expectedCommandNames, commandNames) {