package cli import ( "fmt" "strings" "time" "github.com/google/uuid" "golang.org/x/xerrors" "github.com/coder/coder/v2/cli/clibase" "github.com/coder/coder/v2/cli/cliui" "github.com/coder/coder/v2/codersdk" "github.com/coder/pretty" ) func (r *RootCmd) templateVersions() *clibase.Cmd { cmd := &clibase.Cmd{ Use: "versions", Short: "Manage different versions of the specified template", Aliases: []string{"version"}, Long: formatExamples( example{ Description: "List versions of a specific template", Command: "coder templates versions list my-template", }, ), Handler: func(inv *clibase.Invocation) error { return inv.Command.HelpHandler(inv) }, Children: []*clibase.Cmd{ r.templateVersionsList(), r.archiveTemplateVersion(), r.unarchiveTemplateVersion(), }, } return cmd } func (r *RootCmd) templateVersionsList() *clibase.Cmd { defaultColumns := []string{ "Name", "Created At", "Created By", "Status", "Active", } formatter := cliui.NewOutputFormatter( cliui.TableFormat([]templateVersionRow{}, defaultColumns), cliui.JSONFormat(), ) client := new(codersdk.Client) var includeArchived clibase.Bool cmd := &clibase.Cmd{ Use: "list