mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: fix panic in template pull (#2710)
This commit is contained in:
+1
-1
@@ -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()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user