diff --git a/pkg/ssh/cmd/branch.go b/pkg/ssh/cmd/branch.go index c43ce974f..daa0efaa0 100644 --- a/pkg/ssh/cmd/branch.go +++ b/pkg/ssh/cmd/branch.go @@ -148,6 +148,7 @@ func branchDeleteCommand() *cobra.Command { Use: "delete REPOSITORY BRANCH", Aliases: []string{"remove", "rm", "del"}, Short: "Delete a branch", + Args: cobra.ExactArgs(2), PersistentPreRunE: checkIfCollab, RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() diff --git a/testscript/testdata/repo-delete.txtar b/testscript/testdata/repo-delete.txtar index 403c96043..ca513e782 100644 --- a/testscript/testdata/repo-delete.txtar +++ b/testscript/testdata/repo-delete.txtar @@ -10,6 +10,11 @@ soft repo create repo-to-delete soft repo delete repo-to-delete ! soft repo delete nope stderr '.*not found.*' + +# missing argument should fail +! soft repo branch delete repo1 +stderr 'Error.*accepts 2 arg.*' + soft repo list stdout 'repo1'