Skip to content

Commit 4b6189c

Browse files
authored
fix: fix panic in template pull (#2710)
1 parent 0d25e17 commit 4b6189c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

cli/templatepull.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func templatePull() *cobra.Command {
1717
cmd := &cobra.Command{
1818
Use: "pull <name> [destination]",
1919
Short: "Download the latest version of a template to a path.",
20-
Args: cobra.MaximumNArgs(2),
20+
Args: cobra.RangeArgs(1, 2),
2121
RunE: func(cmd *cobra.Command, args []string) error {
2222
var (
2323
ctx = cmd.Context()

cli/templatepull_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ import (
1919
func TestTemplatePull(t *testing.T) {
2020
t.Parallel()
2121

22+
t.Run("NoName", func(t *testing.T) {
23+
t.Parallel()
24+
25+
cmd, _ := clitest.New(t, "templates", "pull")
26+
err := cmd.Execute()
27+
require.Error(t, err)
28+
})
29+
2230
// Stdout tests that 'templates pull' pulls down the latest template
2331
// and writes it to stdout.
2432
t.Run("Stdout", func(t *testing.T) {

0 commit comments

Comments
 (0)