fix: fix panic in template pull (#2710)

This commit is contained in:
Jon Ayers
2022-06-28 19:54:28 -05:00
committed by GitHub
parent 0d25e1752f
commit 4b6189c9e9
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ func templatePull() *cobra.Command {
cmd := &cobra.Command{
Use: "pull <name> [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()
+8
View File
@@ -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) {