diff --git a/cli/templatepull.go b/cli/templatepull.go index 61cc7e7b8e62b..2b2509ae0b0bf 100644 --- a/cli/templatepull.go +++ b/cli/templatepull.go @@ -17,7 +17,7 @@ func templatePull() *cobra.Command { cmd := &cobra.Command{ Use: "pull [destination]", Short: "Download the latest version of a template to a path.", - Args: cobra.MaximumNArgs(2), + Args: cobra.RangeArgs(1, 2), RunE: func(cmd *cobra.Command, args []string) error { var ( ctx = cmd.Context() diff --git a/cli/templatepull_test.go b/cli/templatepull_test.go index 249733c8c043b..020fcebf705da 100644 --- a/cli/templatepull_test.go +++ b/cli/templatepull_test.go @@ -19,6 +19,14 @@ import ( func TestTemplatePull(t *testing.T) { t.Parallel() + t.Run("NoName", func(t *testing.T) { + t.Parallel() + + cmd, _ := clitest.New(t, "templates", "pull") + err := cmd.Execute() + require.Error(t, err) + }) + // Stdout tests that 'templates pull' pulls down the latest template // and writes it to stdout. t.Run("Stdout", func(t *testing.T) {