Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename edit command to copy #3094

Merged
merged 1 commit into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions commands/rpkgcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

"github.com/GoogleContainerTools/kpt/internal/cmdrpkgapprove"
"github.com/GoogleContainerTools/kpt/internal/cmdrpkgclone"
"github.com/GoogleContainerTools/kpt/internal/cmdrpkgcopy"
"github.com/GoogleContainerTools/kpt/internal/cmdrpkgdel"
"github.com/GoogleContainerTools/kpt/internal/cmdrpkgedit"
"github.com/GoogleContainerTools/kpt/internal/cmdrpkgget"
"github.com/GoogleContainerTools/kpt/internal/cmdrpkginit"
"github.com/GoogleContainerTools/kpt/internal/cmdrpkgpropose"
Expand Down Expand Up @@ -76,7 +76,7 @@ func NewRpkgCommand(ctx context.Context, version string) *cobra.Command {
cmdrpkgapprove.NewCommand(ctx, kubeflags),
cmdrpkgreject.NewCommand(ctx, kubeflags),
cmdrpkgdel.NewCommand(ctx, kubeflags),
cmdrpkgedit.NewCommand(ctx, kubeflags),
cmdrpkgcopy.NewCommand(ctx, kubeflags),
)

return repo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package cmdrpkgedit
package cmdrpkgcopy

import (
"context"
Expand All @@ -28,9 +28,9 @@ import (
)

const (
command = "cmdrpkgedit"
command = "cmdrpkgcopy"
longMsg = `
kpt alpha rpkg edit SOURCE_PACKAGE NAME
kpt alpha rpkg copy SOURCE_PACKAGE NAME

Creates a new copy of a source package in the target repository.

Expand Down Expand Up @@ -63,10 +63,11 @@ func newRunner(ctx context.Context, rcg *genericclioptions.ConfigFlags) *runner
cfg: rcg,
}
c := &cobra.Command{
Use: "edit SOURCE_PACKAGE NAME",
Use: "copy SOURCE_PACKAGE NAME",
Aliases: []string{"edit"},
Short: "Creates a copy of a source package in the target repository.",
Long: longMsg,
Example: "kpt alpha rpkg edit upstream-package-name target-package-name --repository target-repository --revision v1",
Example: "kpt alpha rpkg copy upstream-package-name target-package-name --repository target-repository --revision v1",
PreRunE: r.preRunE,
RunE: r.runE,
Hidden: porch.HidePorchCommands,
Expand All @@ -85,7 +86,7 @@ type runner struct {
client client.Client
Command *cobra.Command

edit porchapi.PackageEditTaskSpec
copy porchapi.PackageEditTaskSpec

repository string // Target repository
revision string // Target package revision
Expand All @@ -111,7 +112,7 @@ func (r *runner) preRunE(cmd *cobra.Command, args []string) error {
source := args[0]
target := args[1]

r.edit.Source = &porchapi.PackageRevisionRef{
r.copy.Source = &porchapi.PackageRevisionRef{
Name: source,
}

Expand All @@ -138,7 +139,7 @@ func (r *runner) runE(cmd *cobra.Command, args []string) error {
Tasks: []porchapi.Task{
{
Type: porchapi.TaskTypeEdit,
Edit: &r.edit,
Edit: &r.copy,
},
},
},
Expand Down