mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
* Add templates
* Move API structs to codersdk
* Back to green tests!
* It all works, but now with tea! 🧋
* It works!
* Add cancellation to provisionerd
* Tests pass!
* Add deletion of workspaces and projects
* Fix agent lock
* Add clog
* Fix linting errors
* Remove unused CLI tests
* Rename daemon to start
* Fix leaking command
* Fix promptui test
* Update agent connection frequency
* Skip login tests on Windows
* Increase tunnel connect timeout
* Fix templater
* Lower test requirements
* Fix embed
* Disable promptui tests for Windows
* Fix write newline
* Fix PTY write newline
* Fix CloseReader
* Fix compilation on Windows
* Fix linting error
* Remove bubbletea
* Cleanup readwriter
* Use embedded templates instead of serving over API
* Move templates to examples
* Improve workspace create flow
* Fix Windows build
* Fix tests
* Fix linting errors
* Fix untar with extracting max size
* Fix newline char
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"text/tabwriter"
|
|
|
|
"github.com/fatih/color"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func parameterList() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "list <scope> <scope-id>",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
client, err := createClient(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
organization, err := currentOrganization(cmd, client)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
name := ""
|
|
if len(args) >= 2 {
|
|
name = args[1]
|
|
}
|
|
scope, scopeID, err := parseScopeAndID(cmd.Context(), client, organization, args[0], name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
params, err := client.Parameters(cmd.Context(), scope, scopeID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
writer := tabwriter.NewWriter(cmd.OutOrStdout(), 0, 0, 4, ' ', 0)
|
|
_, _ = fmt.Fprintf(writer, "%s\t%s\t%s\n",
|
|
color.HiBlackString("Parameter"),
|
|
color.HiBlackString("Created"),
|
|
color.HiBlackString("Scheme"))
|
|
for _, param := range params {
|
|
_, _ = fmt.Fprintf(writer, "%s\t%s\t%s\n",
|
|
color.New(color.FgHiCyan).Sprint(param.Name),
|
|
color.WhiteString(param.UpdatedAt.Format("January 2, 2006")),
|
|
color.New(color.FgHiWhite).Sprint(param.DestinationScheme))
|
|
}
|
|
return writer.Flush()
|
|
},
|
|
}
|
|
}
|