feat(cli): add shell completions (#14341)

This commit is contained in:
Ethan
2024-08-20 14:47:46 +10:00
committed by GitHub
parent 6f9b3c1592
commit 0b2ba96065
80 changed files with 510 additions and 418 deletions
+4 -4
View File
@@ -65,8 +65,8 @@ func (f *OutputFormatter) AttachOptions(opts *serpent.OptionSet) {
Flag: "output",
FlagShorthand: "o",
Default: f.formats[0].ID(),
Value: serpent.StringOf(&f.formatID),
Description: "Output format. Available formats: " + strings.Join(formatNames, ", ") + ".",
Value: serpent.EnumOf(&f.formatID, formatNames...),
Description: "Output format.",
},
)
}
@@ -136,8 +136,8 @@ func (f *tableFormat) AttachOptions(opts *serpent.OptionSet) {
Flag: "column",
FlagShorthand: "c",
Default: strings.Join(f.defaultColumns, ","),
Value: serpent.StringArrayOf(&f.columns),
Description: "Columns to display in table output. Available columns: " + strings.Join(f.allColumns, ", ") + ".",
Value: serpent.EnumArrayOf(&f.columns, f.allColumns...),
Description: "Columns to display in table output.",
},
)
}
+8 -9
View File
@@ -106,11 +106,11 @@ func Test_OutputFormatter(t *testing.T) {
fs := cmd.Options.FlagSet()
selected, err := fs.GetString("output")
require.NoError(t, err)
require.Equal(t, "json", selected)
selected := cmd.Options.ByFlag("output")
require.NotNil(t, selected)
require.Equal(t, "json", selected.Value.String())
usage := fs.FlagUsages()
require.Contains(t, usage, "Available formats: json, foo")
require.Contains(t, usage, "Output format.")
require.Contains(t, usage, "foo flag 1234")
ctx := context.Background()
@@ -129,11 +129,10 @@ func Test_OutputFormatter(t *testing.T) {
require.Equal(t, "foo", out)
require.EqualValues(t, 1, atomic.LoadInt64(&called))
require.NoError(t, fs.Set("output", "bar"))
require.Error(t, fs.Set("output", "bar"))
out, err = f.Format(ctx, data)
require.Error(t, err)
require.ErrorContains(t, err, "bar")
require.Equal(t, "", out)
require.EqualValues(t, 1, atomic.LoadInt64(&called))
require.NoError(t, err)
require.Equal(t, "foo", out)
require.EqualValues(t, 2, atomic.LoadInt64(&called))
})
}
+89
View File
@@ -0,0 +1,89 @@
package cli
import (
"fmt"
"github.com/coder/coder/v2/cli/cliui"
"github.com/coder/serpent"
"github.com/coder/serpent/completion"
)
func (*RootCmd) completion() *serpent.Command {
var shellName string
var printOutput bool
shellOptions := completion.ShellOptions(&shellName)
return &serpent.Command{
Use: "completion",
Short: "Install or update shell completion scripts for the detected or chosen shell.",
Options: []serpent.Option{
{
Flag: "shell",
FlagShorthand: "s",
Description: "The shell to install completion for.",
Value: shellOptions,
},
{
Flag: "print",
Description: "Print the completion script instead of installing it.",
FlagShorthand: "p",
Value: serpent.BoolOf(&printOutput),
},
},
Handler: func(inv *serpent.Invocation) error {
if shellName != "" {
shell, err := completion.ShellByName(shellName, inv.Command.Parent.Name())
if err != nil {
return err
}
if printOutput {
return shell.WriteCompletion(inv.Stdout)
}
return installCompletion(inv, shell)
}
shell, err := completion.DetectUserShell(inv.Command.Parent.Name())
if err == nil {
return installCompletion(inv, shell)
}
// Silently continue to the shell selection if detecting failed.
choice, err := cliui.Select(inv, cliui.SelectOptions{
Message: "Select a shell to install completion for:",
Options: shellOptions.Choices,
})
if err != nil {
return err
}
shellChoice, err := completion.ShellByName(choice, inv.Command.Parent.Name())
if err != nil {
return err
}
if printOutput {
return shellChoice.WriteCompletion(inv.Stdout)
}
return installCompletion(inv, shellChoice)
},
}
}
func installCompletion(inv *serpent.Invocation, shell completion.Shell) error {
path, err := shell.InstallPath()
if err != nil {
cliui.Error(inv.Stderr, fmt.Sprintf("Failed to determine completion path %v", err))
return shell.WriteCompletion(inv.Stdout)
}
choice, err := cliui.Select(inv, cliui.SelectOptions{
Options: []string{
"Confirm",
"Print to terminal",
},
Message: fmt.Sprintf("Install completion for %s at %s?", shell.Name(), path),
HideSearch: true,
})
if err != nil {
return err
}
if choice == "Print to terminal" {
return shell.WriteCompletion(inv.Stdout)
}
return completion.InstallShellCompletion(shell)
}
+2 -45
View File
@@ -17,6 +17,7 @@ import (
"strings"
"github.com/cli/safeexec"
"github.com/natefinch/atomic"
"github.com/pkg/diff"
"github.com/pkg/diff/write"
"golang.org/x/exp/constraints"
@@ -524,7 +525,7 @@ func (r *RootCmd) configSSH() *serpent.Command {
}
if !bytes.Equal(configRaw, configModified) {
err = writeWithTempFileAndMove(sshConfigFile, bytes.NewReader(configModified))
err = atomic.WriteFile(sshConfigFile, bytes.NewReader(configModified))
if err != nil {
return xerrors.Errorf("write ssh config failed: %w", err)
}
@@ -758,50 +759,6 @@ func sshConfigSplitOnCoderSection(data []byte) (before, section []byte, after []
return data, nil, nil, nil
}
// writeWithTempFileAndMove writes to a temporary file in the same
// directory as path and renames the temp file to the file provided in
// path. This ensure we avoid trashing the file we are writing due to
// unforeseen circumstance like filesystem full, command killed, etc.
func writeWithTempFileAndMove(path string, r io.Reader) (err error) {
dir := filepath.Dir(path)
name := filepath.Base(path)
// Ensure that e.g. the ~/.ssh directory exists.
if err = os.MkdirAll(dir, 0o700); err != nil {
return xerrors.Errorf("create directory: %w", err)
}
// Create a tempfile in the same directory for ensuring write
// operation does not fail.
f, err := os.CreateTemp(dir, fmt.Sprintf(".%s.", name))
if err != nil {
return xerrors.Errorf("create temp file failed: %w", err)
}
defer func() {
if err != nil {
_ = os.Remove(f.Name()) // Cleanup in case a step failed.
}
}()
_, err = io.Copy(f, r)
if err != nil {
_ = f.Close()
return xerrors.Errorf("write temp file failed: %w", err)
}
err = f.Close()
if err != nil {
return xerrors.Errorf("close temp file failed: %w", err)
}
err = os.Rename(f.Name(), path)
if err != nil {
return xerrors.Errorf("rename temp file failed: %w", err)
}
return nil
}
// sshConfigExecEscape quotes the string if it contains spaces, as per
// `man 5 ssh_config`. However, OpenSSH uses exec in the users shell to
// run the command, and as such the formatting/escape requirements
+2
View File
@@ -81,6 +81,8 @@ var usageTemplate = func() *template.Template {
switch v := opt.Value.(type) {
case *serpent.Enum:
return strings.Join(v.Choices, "|")
case *serpent.EnumArray:
return fmt.Sprintf("[%s]", strings.Join(v.Choices, "|"))
default:
return v.Type()
}
+1 -1
View File
@@ -137,7 +137,7 @@ func (r *RootCmd) assignOrganizationRoles(orgContext *OrganizationContext) *serp
func (r *RootCmd) listOrganizationMembers(orgContext *OrganizationContext) *serpent.Command {
formatter := cliui.NewOutputFormatter(
cliui.TableFormat([]codersdk.OrganizationMemberWithUserData{}, []string{"username", "organization_roles"}),
cliui.TableFormat([]codersdk.OrganizationMemberWithUserData{}, []string{"username", "organization roles"}),
cliui.JSONFormat(),
)
+1 -1
View File
@@ -23,7 +23,7 @@ func TestListOrganizationMembers(t *testing.T) {
client, user := coderdtest.CreateAnotherUser(t, ownerClient, owner.OrganizationID, rbac.RoleUserAdmin())
ctx := testutil.Context(t, testutil.WaitMedium)
inv, root := clitest.New(t, "organization", "members", "list", "-c", "user_id,username,roles")
inv, root := clitest.New(t, "organization", "members", "list", "-c", "user id,username,organization roles")
clitest.SetupConfig(t, client, root)
buf := new(bytes.Buffer)
+7 -7
View File
@@ -36,7 +36,7 @@ func (r *RootCmd) organizationRoles(orgContext *OrganizationContext) *serpent.Co
func (r *RootCmd) showOrganizationRoles(orgContext *OrganizationContext) *serpent.Command {
formatter := cliui.NewOutputFormatter(
cliui.ChangeFormatterData(
cliui.TableFormat([]roleTableRow{}, []string{"name", "display_name", "site_permissions", "organization_permissions", "user_permissions"}),
cliui.TableFormat([]roleTableRow{}, []string{"name", "display name", "site permissions", "organization permissions", "user permissions"}),
func(data any) (any, error) {
inputs, ok := data.([]codersdk.AssignableRoles)
if !ok {
@@ -103,7 +103,7 @@ func (r *RootCmd) showOrganizationRoles(orgContext *OrganizationContext) *serpen
func (r *RootCmd) editOrganizationRole(orgContext *OrganizationContext) *serpent.Command {
formatter := cliui.NewOutputFormatter(
cliui.ChangeFormatterData(
cliui.TableFormat([]roleTableRow{}, []string{"name", "display_name", "site_permissions", "organization_permissions", "user_permissions"}),
cliui.TableFormat([]roleTableRow{}, []string{"name", "display name", "site permissions", "organization permissions", "user permissions"}),
func(data any) (any, error) {
typed, _ := data.(codersdk.Role)
return []roleTableRow{roleToTableView(typed)}, nil
@@ -408,10 +408,10 @@ func roleToTableView(role codersdk.Role) roleTableRow {
type roleTableRow struct {
Name string `table:"name,default_sort"`
DisplayName string `table:"display_name"`
OrganizationID string `table:"organization_id"`
SitePermissions string ` table:"site_permissions"`
DisplayName string `table:"display name"`
OrganizationID string `table:"organization id"`
SitePermissions string ` table:"site permissions"`
// map[<org_id>] -> Permissions
OrganizationPermissions string `table:"organization_permissions"`
UserPermissions string `table:"user_permissions"`
OrganizationPermissions string `table:"organization permissions"`
UserPermissions string `table:"user permissions"`
}
+1
View File
@@ -82,6 +82,7 @@ const (
func (r *RootCmd) CoreSubcommands() []*serpent.Command {
// Please re-sort this list alphabetically if you change it!
return []*serpent.Command{
r.completion(),
r.dotfiles(),
r.externalAuth(),
r.login(),
+10 -10
View File
@@ -32,11 +32,11 @@ func (r *RootCmd) stat() *serpent.Command {
fs = afero.NewReadOnlyFs(afero.NewOsFs())
formatter = cliui.NewOutputFormatter(
cliui.TableFormat([]statsRow{}, []string{
"host_cpu",
"host_memory",
"home_disk",
"container_cpu",
"container_memory",
"host cpu",
"host memory",
"home disk",
"container cpu",
"container memory",
}),
cliui.JSONFormat(),
)
@@ -284,9 +284,9 @@ func (*RootCmd) statDisk(fs afero.Fs) *serpent.Command {
}
type statsRow struct {
HostCPU *clistat.Result `json:"host_cpu" table:"host_cpu,default_sort"`
HostMemory *clistat.Result `json:"host_memory" table:"host_memory"`
Disk *clistat.Result `json:"home_disk" table:"home_disk"`
ContainerCPU *clistat.Result `json:"container_cpu" table:"container_cpu"`
ContainerMemory *clistat.Result `json:"container_memory" table:"container_memory"`
HostCPU *clistat.Result `json:"host_cpu" table:"host cpu,default_sort"`
HostMemory *clistat.Result `json:"host_memory" table:"host memory"`
Disk *clistat.Result `json:"home_disk" table:"home disk"`
ContainerCPU *clistat.Result `json:"container_cpu" table:"container cpu"`
ContainerMemory *clistat.Result `json:"container_memory" table:"container memory"`
}
+3 -25
View File
@@ -3,7 +3,6 @@ package cli
import (
"fmt"
"net/http"
"strings"
"time"
"golang.org/x/xerrors"
@@ -239,35 +238,14 @@ func (r *RootCmd) templateEdit() *serpent.Command {
Value: serpent.DurationOf(&activityBump),
},
{
Flag: "autostart-requirement-weekdays",
// workspaces created from this template must be restarted on the given weekdays. To unset this value for the template (and disable the autostop requirement for the template), pass 'none'.
Flag: "autostart-requirement-weekdays",
Description: "Edit the template autostart requirement weekdays - workspaces created from this template can only autostart on the given weekdays. To unset this value for the template (and allow autostart on all days), pass 'all'.",
Value: serpent.Validate(serpent.StringArrayOf(&autostartRequirementDaysOfWeek), func(value *serpent.StringArray) error {
v := value.GetSlice()
if len(v) == 1 && v[0] == "all" {
return nil
}
_, err := codersdk.WeekdaysToBitmap(v)
if err != nil {
return xerrors.Errorf("invalid autostart requirement days of week %q: %w", strings.Join(v, ","), err)
}
return nil
}),
Value: serpent.EnumArrayOf(&autostartRequirementDaysOfWeek, append(codersdk.AllDaysOfWeek, "all")...),
},
{
Flag: "autostop-requirement-weekdays",
Description: "Edit the template autostop requirement weekdays - workspaces created from this template must be restarted on the given weekdays. To unset this value for the template (and disable the autostop requirement for the template), pass 'none'.",
Value: serpent.Validate(serpent.StringArrayOf(&autostopRequirementDaysOfWeek), func(value *serpent.StringArray) error {
v := value.GetSlice()
if len(v) == 1 && v[0] == "none" {
return nil
}
_, err := codersdk.WeekdaysToBitmap(v)
if err != nil {
return xerrors.Errorf("invalid autostop requirement days of week %q: %w", strings.Join(v, ","), err)
}
return nil
}),
Value: serpent.EnumArrayOf(&autostopRequirementDaysOfWeek, append(codersdk.AllDaysOfWeek, "none")...),
},
{
Flag: "autostop-requirement-weeks",
+7 -7
View File
@@ -40,11 +40,11 @@ func (r *RootCmd) templateVersions() *serpent.Command {
func (r *RootCmd) templateVersionsList() *serpent.Command {
defaultColumns := []string{
"Name",
"Created At",
"Created By",
"Status",
"Active",
"name",
"created at",
"created by",
"status",
"active",
}
formatter := cliui.NewOutputFormatter(
cliui.TableFormat([]templateVersionRow{}, defaultColumns),
@@ -70,10 +70,10 @@ func (r *RootCmd) templateVersionsList() *serpent.Command {
for _, opt := range i.Command.Options {
if opt.Flag == "column" {
if opt.ValueSource == serpent.ValueSourceDefault {
v, ok := opt.Value.(*serpent.StringArray)
v, ok := opt.Value.(*serpent.EnumArray)
if ok {
// Add the extra new default column.
*v = append(*v, "Archived")
_ = v.Append("Archived")
}
}
break
+2
View File
@@ -15,6 +15,8 @@ USAGE:
SUBCOMMANDS:
autoupdate Toggle auto-update policy for a workspace
completion Install or update shell completion scripts for the
detected or chosen shell.
config-ssh Add an SSH Host entry for your workspaces "ssh
coder.workspace"
create Create a workspace
+16
View File
@@ -0,0 +1,16 @@
coder v0.0.0-devel
USAGE:
coder completion [flags]
Install or update shell completion scripts for the detected or chosen shell.
OPTIONS:
-p, --print bool
Print the completion script instead of installing it.
-s, --shell bash|fish|zsh|powershell
The shell to install completion for.
———
Run `coder --help` for a list of global options.
+4 -7
View File
@@ -11,14 +11,11 @@ OPTIONS:
-a, --all bool
Specifies whether all workspaces will be listed or not.
-c, --column string-array (default: workspace,template,status,healthy,last built,current version,outdated,starts at,stops after)
Columns to display in table output. Available columns: favorite,
workspace, organization id, organization name, template, status,
healthy, last built, current version, outdated, starts at, starts
next, stops after, stops next, daily cost.
-c, --column [favorite|workspace|organization id|organization name|template|status|healthy|last built|current version|outdated|starts at|starts next|stops after|stops next|daily cost] (default: workspace,template,status,healthy,last built,current version,outdated,starts at,stops after)
Columns to display in table output.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
--search string (default: owner:me)
Search for a workspace with a query.
+4 -5
View File
@@ -15,12 +15,11 @@ OPTIONS:
-a, --all bool
Specifies whether all workspaces will be listed or not.
-c, --column string-array (default: workspace,starts at,starts next,stops after,stops next)
Columns to display in table output. Available columns: workspace,
starts at, starts next, stops after, stops next.
-c, --column [workspace|starts at|starts next|stops after|stops next] (default: workspace,starts at,starts next,stops after,stops next)
Columns to display in table output.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
--search string (default: owner:me)
Search for a workspace with a query.
+4 -5
View File
@@ -6,9 +6,8 @@ USAGE:
Run upload and download tests from your machine to a workspace
OPTIONS:
-c, --column string-array (default: Interval,Throughput)
Columns to display in table output. Available columns: Interval,
Throughput.
-c, --column [Interval|Throughput] (default: Interval,Throughput)
Columns to display in table output.
-d, --direct bool
Specifies whether to wait for a direct connection before testing
@@ -18,8 +17,8 @@ OPTIONS:
Specifies whether to run in reverse mode where the client receives and
the server sends.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
--pcap-file string
Specifies a file to write a network capture to.
+4 -5
View File
@@ -11,12 +11,11 @@ SUBCOMMANDS:
mem Show memory usage, in gigabytes.
OPTIONS:
-c, --column string-array (default: host_cpu,host_memory,home_disk,container_cpu,container_memory)
Columns to display in table output. Available columns: host cpu, host
memory, home disk, container cpu, container memory.
-c, --column [host cpu|host memory|home disk|container cpu|container memory] (default: host cpu,host memory,home disk,container cpu,container memory)
Columns to display in table output.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+2 -2
View File
@@ -9,8 +9,8 @@ OPTIONS:
--host bool
Force host CPU measurement.
-o, --output string (default: text)
Output format. Available formats: text, json.
-o, --output text|json (default: text)
Output format.
———
Run `coder --help` for a list of global options.
+2 -2
View File
@@ -6,8 +6,8 @@ USAGE:
Show disk usage, in gigabytes.
OPTIONS:
-o, --output string (default: text)
Output format. Available formats: text, json.
-o, --output text|json (default: text)
Output format.
--path string (default: /)
Path for which to check disk usage.
+2 -2
View File
@@ -9,8 +9,8 @@ OPTIONS:
--host bool
Force host memory measurement.
-o, --output string (default: text)
Output format. Available formats: text, json.
-o, --output text|json (default: text)
Output format.
--prefix Ki|Mi|Gi|Ti (default: Gi)
SI Prefix for memory measurement.
+2 -2
View File
@@ -25,13 +25,13 @@ OPTIONS:
--allow-user-cancel-workspace-jobs bool (default: true)
Allow users to cancel in-progress workspace jobs.
--autostart-requirement-weekdays string-array
--autostart-requirement-weekdays [monday|tuesday|wednesday|thursday|friday|saturday|sunday|all]
Edit the template autostart requirement weekdays - workspaces created
from this template can only autostart on the given weekdays. To unset
this value for the template (and allow autostart on all days), pass
'all'.
--autostop-requirement-weekdays string-array
--autostop-requirement-weekdays [monday|tuesday|wednesday|thursday|friday|saturday|sunday|none]
Edit the template autostop requirement weekdays - workspaces created
from this template must be restarted on the given weekdays. To unset
this value for the template (and disable the autostop requirement for
+4 -6
View File
@@ -8,13 +8,11 @@ USAGE:
Aliases: ls
OPTIONS:
-c, --column string-array (default: name,organization name,last updated,used by)
Columns to display in table output. Available columns: name, created
at, last updated, organization id, organization name, provisioner,
active version id, used by, default ttl.
-c, --column [name|created at|last updated|organization id|organization name|provisioner|active version id|used by|default ttl] (default: name,organization name,last updated,used by)
Columns to display in table output.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+4 -5
View File
@@ -9,15 +9,14 @@ OPTIONS:
-O, --org string, $CODER_ORGANIZATION
Select which organization (uuid or name) to use.
-c, --column string-array (default: Name,Created At,Created By,Status,Active)
Columns to display in table output. Available columns: name, created
at, created by, status, active, archived.
-c, --column [name|created at|created by|status|active|archived] (default: name,created at,created by,status,active)
Columns to display in table output.
--include-archived bool
Include archived versions in the result list.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+4 -5
View File
@@ -12,12 +12,11 @@ OPTIONS:
Specifies whether all users' tokens will be listed or not (must have
Owner role to see all tokens).
-c, --column string-array (default: id,name,last used,expires at,created at)
Columns to display in table output. Available columns: id, name, last
used, expires at, created at, owner.
-c, --column [id|name|last used|expires at|created at|owner] (default: id,name,last used,expires at,created at)
Columns to display in table output.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+1 -1
View File
@@ -11,7 +11,7 @@ USAGE:
$ coder users activate example_user
OPTIONS:
-c, --column string-array (default: username,email,created_at,status)
-c, --column [username|email|created at|status] (default: username,email,created at,status)
Specify a column to filter in the table.
———
+4 -5
View File
@@ -6,12 +6,11 @@ USAGE:
Aliases: ls
OPTIONS:
-c, --column string-array (default: username,email,created_at,status)
Columns to display in table output. Available columns: id, username,
email, created at, updated at, status.
-c, --column [id|username|email|created at|updated at|status] (default: username,email,created at,status)
Columns to display in table output.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+2 -2
View File
@@ -8,8 +8,8 @@ USAGE:
$ coder users show me
OPTIONS:
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+1 -1
View File
@@ -9,7 +9,7 @@ USAGE:
$ coder users suspend example_user
OPTIONS:
-c, --column string-array (default: username,email,created_at,status)
-c, --column [username|email|created at|status] (default: username,email,created at,status)
Specify a column to filter in the table.
———
+2 -2
View File
@@ -6,8 +6,8 @@ USAGE:
Show coder version
OPTIONS:
-o, --output string (default: text)
Output format. Available formats: text, json.
-o, --output text|json (default: text)
Output format.
———
Run `coder --help` for a list of global options.
+1 -1
View File
@@ -15,7 +15,7 @@ import (
func (r *RootCmd) userList() *serpent.Command {
formatter := cliui.NewOutputFormatter(
cliui.TableFormat([]codersdk.User{}, []string{"username", "email", "created_at", "status"}),
cliui.TableFormat([]codersdk.User{}, []string{"username", "email", "created at", "status"}),
cliui.JSONFormat(),
)
client := new(codersdk.Client)
+3 -2
View File
@@ -36,6 +36,7 @@ func (r *RootCmd) createUserStatusCommand(sdkStatus codersdk.UserStatus) *serpen
client := new(codersdk.Client)
var columns []string
allColumns := []string{"username", "email", "created at", "status"}
cmd := &serpent.Command{
Use: fmt.Sprintf("%s <username|user_id>", verb),
Short: short,
@@ -99,8 +100,8 @@ func (r *RootCmd) createUserStatusCommand(sdkStatus codersdk.UserStatus) *serpen
Flag: "column",
FlagShorthand: "c",
Description: "Specify a column to filter in the table.",
Default: strings.Join([]string{"username", "email", "created_at", "status"}, ","),
Value: serpent.StringArrayOf(&columns),
Default: strings.Join(allColumns, ","),
Value: serpent.EnumArrayOf(&columns, allColumns...),
},
}
return cmd
+4 -4
View File
@@ -42,7 +42,7 @@ func ProvisionerTypeValid[T ProvisionerType | string](pt T) error {
type MinimalOrganization struct {
ID uuid.UUID `table:"id" json:"id" validate:"required" format:"uuid"`
Name string `table:"name,default_sort" json:"name"`
DisplayName string `table:"display_name" json:"display_name"`
DisplayName string `table:"display name" json:"display_name"`
Icon string `table:"icon" json:"icon"`
}
@@ -50,8 +50,8 @@ type MinimalOrganization struct {
type Organization struct {
MinimalOrganization `table:"m,recursive_inline"`
Description string `table:"description" json:"description"`
CreatedAt time.Time `table:"created_at" json:"created_at" validate:"required" format:"date-time"`
UpdatedAt time.Time `table:"updated_at" json:"updated_at" validate:"required" format:"date-time"`
CreatedAt time.Time `table:"created at" json:"created_at" validate:"required" format:"date-time"`
UpdatedAt time.Time `table:"updated at" json:"updated_at" validate:"required" format:"date-time"`
IsDefault bool `table:"default" json:"is_default" validate:"required"`
}
@@ -67,7 +67,7 @@ type OrganizationMember struct {
OrganizationID uuid.UUID `table:"organization id" json:"organization_id" format:"uuid"`
CreatedAt time.Time `table:"created at" json:"created_at" format:"date-time"`
UpdatedAt time.Time `table:"updated at" json:"updated_at" format:"date-time"`
Roles []SlimRole `table:"organization_roles" json:"roles"`
Roles []SlimRole `table:"organization roles" json:"roles"`
}
type OrganizationMemberWithUserData struct {
+2 -2
View File
@@ -275,8 +275,8 @@ func (c *Client) ServeProvisionerDaemon(ctx context.Context, req ServeProvisione
type ProvisionerKey struct {
ID uuid.UUID `json:"id" table:"-" format:"uuid"`
CreatedAt time.Time `json:"created_at" table:"created_at" format:"date-time"`
OrganizationID uuid.UUID `json:"organization" table:"organization_id" format:"uuid"`
CreatedAt time.Time `json:"created_at" table:"created at" format:"date-time"`
OrganizationID uuid.UUID `json:"organization" table:"organization id" format:"uuid"`
Name string `json:"name" table:"name,default_sort"`
Tags map[string]string `json:"tags" table:"tags"`
// HashedSecret - never include the access token in the API response
+9 -9
View File
@@ -53,22 +53,22 @@ type Permission struct {
// Role is a longer form of SlimRole that includes permissions details.
type Role struct {
Name string `json:"name" table:"name,default_sort" validate:"username"`
OrganizationID string `json:"organization_id,omitempty" table:"organization_id" format:"uuid"`
DisplayName string `json:"display_name" table:"display_name"`
SitePermissions []Permission `json:"site_permissions" table:"site_permissions"`
OrganizationID string `json:"organization_id,omitempty" table:"organization id" format:"uuid"`
DisplayName string `json:"display_name" table:"display name"`
SitePermissions []Permission `json:"site_permissions" table:"site permissions"`
// OrganizationPermissions are specific for the organization in the field 'OrganizationID' above.
OrganizationPermissions []Permission `json:"organization_permissions" table:"organization_permissions"`
UserPermissions []Permission `json:"user_permissions" table:"user_permissions"`
OrganizationPermissions []Permission `json:"organization_permissions" table:"organization permissions"`
UserPermissions []Permission `json:"user_permissions" table:"user permissions"`
}
// CustomRoleRequest is used to edit custom roles.
type CustomRoleRequest struct {
Name string `json:"name" table:"name,default_sort" validate:"username"`
DisplayName string `json:"display_name" table:"display_name"`
SitePermissions []Permission `json:"site_permissions" table:"site_permissions"`
DisplayName string `json:"display_name" table:"display name"`
SitePermissions []Permission `json:"site_permissions" table:"site permissions"`
// OrganizationPermissions are specific to the organization the role belongs to.
OrganizationPermissions []Permission `json:"organization_permissions" table:"organization_permissions"`
UserPermissions []Permission `json:"user_permissions" table:"user_permissions"`
OrganizationPermissions []Permission `json:"organization_permissions" table:"organization permissions"`
UserPermissions []Permission `json:"user_permissions" table:"user permissions"`
}
// FullName returns the role name scoped to the organization ID. This is useful if
+2
View File
@@ -118,6 +118,8 @@ func BitmapToWeekdays(bitmap uint8) []string {
return days
}
var AllDaysOfWeek = []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}
type TemplateAutostartRequirement struct {
// DaysOfWeek is a list of days of the week in which autostart is allowed
// to happen. If no days are specified, autostart is not allowed.
+8 -8
View File
@@ -32,7 +32,7 @@ type WorkspaceProxyStatus struct {
Status ProxyHealthStatus `json:"status" table:"status,default_sort"`
// Report provides more information about the health of the workspace proxy.
Report ProxyHealthReport `json:"report,omitempty" table:"report"`
CheckedAt time.Time `json:"checked_at" table:"checked_at" format:"date-time"`
CheckedAt time.Time `json:"checked_at" table:"checked at" format:"date-time"`
}
// ProxyHealthReport is a report of the health of the workspace proxy.
@@ -48,16 +48,16 @@ type ProxyHealthReport struct {
type WorkspaceProxy struct {
// Extends Region with extra information
Region `table:"region,recursive_inline"`
DerpEnabled bool `json:"derp_enabled" table:"derp_enabled"`
DerpOnly bool `json:"derp_only" table:"derp_only"`
DerpEnabled bool `json:"derp_enabled" table:"derp enabled"`
DerpOnly bool `json:"derp_only" table:"derp only"`
// Status is the latest status check of the proxy. This will be empty for deleted
// proxies. This value can be used to determine if a workspace proxy is healthy
// and ready to use.
Status WorkspaceProxyStatus `json:"status,omitempty" table:"proxy,recursive"`
CreatedAt time.Time `json:"created_at" format:"date-time" table:"created_at"`
UpdatedAt time.Time `json:"updated_at" format:"date-time" table:"updated_at"`
CreatedAt time.Time `json:"created_at" format:"date-time" table:"created at"`
UpdatedAt time.Time `json:"updated_at" format:"date-time" table:"updated at"`
Deleted bool `json:"deleted" table:"deleted"`
Version string `json:"version" table:"version"`
}
@@ -187,8 +187,8 @@ type RegionsResponse[R RegionTypes] struct {
type Region struct {
ID uuid.UUID `json:"id" format:"uuid" table:"id"`
Name string `json:"name" table:"name,default_sort"`
DisplayName string `json:"display_name" table:"display_name"`
IconURL string `json:"icon_url" table:"icon_url"`
DisplayName string `json:"display_name" table:"display name"`
IconURL string `json:"icon_url" table:"icon url"`
Healthy bool `json:"healthy" table:"healthy"`
// PathAppURL is the URL to the base path for path apps. Optional
@@ -200,7 +200,7 @@ type Region struct {
// E.g. *.us.example.com
// E.g. *--suffix.au.example.com
// Optional. Does not need to be on the same domain as PathAppURL.
WildcardHostname string `json:"wildcard_hostname" table:"wildcard_hostname"`
WildcardHostname string `json:"wildcard_hostname" table:"wildcard hostname"`
}
func (c *Client) Regions(ctx context.Context) ([]Region, error) {
+5
View File
@@ -652,6 +652,11 @@
"title": "coder",
"path": "reference/cli/README.md"
},
{
"title": "completion",
"description": "Install or update shell completion scripts for the detected or chosen shell.",
"path": "reference/cli/completion.md"
},
{
"title": "config-ssh",
"description": "Add an SSH Host entry for your workspaces \"ssh coder.workspace\"",
+1
View File
@@ -25,6 +25,7 @@ Coder — A tool for provisioning self-hosted development environments with Terr
| Name | Purpose |
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| [<code>completion</code>](./completion.md) | Install or update shell completion scripts for the detected or chosen shell. |
| [<code>dotfiles</code>](./dotfiles.md) | Personalize your workspace by applying a canonical dotfiles repository |
| [<code>external-auth</code>](./external-auth.md) | Manage external authentication |
| [<code>login</code>](./login.md) | Authenticate with Coder deployment |
+29
View File
@@ -0,0 +1,29 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->
# completion
Install or update shell completion scripts for the detected or chosen shell.
## Usage
```console
coder completion [flags]
```
## Options
### -s, --shell
| | |
| ---- | ---------------------------------------- |
| Type | <code>bash\|fish\|zsh\|powershell</code> |
The shell to install completion for.
### -p, --print
| | |
| ---- | ----------------- |
| Type | <code>bool</code> |
Print the completion script instead of installing it.
+1 -1
View File
@@ -84,7 +84,7 @@ Override the default host prefix.
| | |
| ----------- | ---------------------------------- |
| Type | <code>enum[yes\|no\|auto]</code> |
| Type | <code>yes\|no\|auto</code> |
| Environment | <code>$CODER_CONFIGSSH_WAIT</code> |
| Default | <code>auto</code> |
+10 -10
View File
@@ -16,18 +16,18 @@ coder features list [flags]
### -c, --column
| | |
| ------- | -------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>Name,Entitlement,Enabled,Limit,Actual</code> |
| | |
| ------- | -------------------------------------------------------- |
| Type | <code>[name\|entitlement\|enabled\|limit\|actual]</code> |
| Default | <code>name,entitlement,enabled,limit,actual</code> |
Specify a column to filter in the table. Available columns are: Name, Entitlement, Enabled, Limit, Actual.
Specify columns to filter in the table.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats are: table, json.
Output format.
+10 -10
View File
@@ -14,21 +14,21 @@ coder groups list [flags]
### -c, --column
| | |
| ------- | ----------------------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>name,display name,organization id,members,avatar url</code> |
| | |
| ------- | ----------------------------------------------------------------------- |
| Type | <code>[name\|display name\|organization id\|members\|avatar url]</code> |
| Default | <code>name,display name,organization id,members,avatar url</code> |
Columns to display in table output. Available columns: name, display name, organization id, members, avatar url.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
### -O, --org
+10 -10
View File
@@ -18,18 +18,18 @@ coder licenses list [flags]
### -c, --column
| | |
| ------- | ---------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>ID,UUID,Expires At,Uploaded At,Features</code> |
| | |
| ------- | ----------------------------------------------------------------- |
| Type | <code>[id\|uuid\|uploaded at\|features\|expires at\|trial]</code> |
| Default | <code>ID,UUID,Expires At,Uploaded At,Features</code> |
Columns to display in table output. Available columns: id, uuid, uploaded at, features, expires at, trial.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+10 -10
View File
@@ -35,18 +35,18 @@ Search for a workspace with a query.
### -c, --column
| | |
| ------- | -------------------------------------------------------------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>workspace,template,status,healthy,last built,current version,outdated,starts at,stops after</code> |
| | |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Type | <code>[favorite\|workspace\|organization id\|organization name\|template\|status\|healthy\|last built\|current version\|outdated\|starts at\|starts next\|stops after\|stops next\|daily cost]</code> |
| Default | <code>workspace,template,status,healthy,last built,current version,outdated,starts at,stops after</code> |
Columns to display in table output. Available columns: favorite, workspace, organization id, organization name, template, status, healthy, last built, current version, outdated, starts at, starts next, stops after, stops next, daily cost.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+10 -10
View File
@@ -42,18 +42,18 @@ Search for a workspace with a query.
### -c, --column
| | |
| ------- | ------------------------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>workspace,starts at,starts next,stops after,stops next</code> |
| | |
| ------- | ------------------------------------------------------------------------- |
| Type | <code>[workspace\|starts at\|starts next\|stops after\|stops next]</code> |
| Default | <code>workspace,starts at,starts next,stops after,stops next</code> |
Columns to display in table output. Available columns: workspace, starts at, starts next, stops after, stops next.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+6 -6
View File
@@ -930,12 +930,12 @@ URL of a PostgreSQL database. If empty, PostgreSQL binaries will be downloaded f
### --postgres-auth
| | |
| ----------- | -------------------------------------- |
| Type | <code>enum[password\|awsiamrds]</code> |
| Environment | <code>$CODER_PG_AUTH</code> |
| YAML | <code>pgAuth</code> |
| Default | <code>password</code> |
| | |
| ----------- | -------------------------------- |
| Type | <code>password\|awsiamrds</code> |
| Environment | <code>$CODER_PG_AUTH</code> |
| YAML | <code>pgAuth</code> |
| Default | <code>password</code> |
Type of auth to use when connecting to postgres.
+1 -1
View File
@@ -25,7 +25,7 @@ URL of a PostgreSQL database. If empty, the built-in PostgreSQL deployment will
| | |
| ----------- | -------------------------------------- |
| Type | <code>enum[password\|awsiamrds]</code> |
| Type | <code>password\|awsiamrds</code> |
| Environment | <code>$CODER_PG_CONNECTION_AUTH</code> |
| Default | <code>password</code> |
+1 -1
View File
@@ -25,7 +25,7 @@ The connection URL for the Postgres database.
| | |
| ----------- | -------------------------------------- |
| Type | <code>enum[password\|awsiamrds]</code> |
| Type | <code>password\|awsiamrds</code> |
| Environment | <code>$CODER_PG_CONNECTION_AUTH</code> |
| Default | <code>password</code> |
+1 -1
View File
@@ -29,7 +29,7 @@ The connection URL for the Postgres database.
| | |
| ----------- | -------------------------------------- |
| Type | <code>enum[password\|awsiamrds]</code> |
| Type | <code>password\|awsiamrds</code> |
| Environment | <code>$CODER_PG_CONNECTION_AUTH</code> |
| Default | <code>password</code> |
+1 -1
View File
@@ -25,7 +25,7 @@ The connection URL for the Postgres database.
| | |
| ----------- | -------------------------------------- |
| Type | <code>enum[password\|awsiamrds]</code> |
| Type | <code>password\|awsiamrds</code> |
| Environment | <code>$CODER_PG_CONNECTION_AUTH</code> |
| Default | <code>password</code> |
+14 -14
View File
@@ -22,10 +22,10 @@ Specifies whether to wait for a direct connection before testing speed.
### --direction
| | |
| ------- | --------------------------- |
| Type | <code>enum[up\|down]</code> |
| Default | <code>down</code> |
| | |
| ------- | --------------------- |
| Type | <code>up\|down</code> |
| Default | <code>down</code> |
Specifies whether to run in reverse mode where the client receives and the server sends.
@@ -48,18 +48,18 @@ Specifies a file to write a network capture to.
### -c, --column
| | |
| ------- | -------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>Interval,Throughput</code> |
| | |
| ------- | ----------------------------------- |
| Type | <code>[Interval\|Throughput]</code> |
| Default | <code>Interval,Throughput</code> |
Columns to display in table output. Available columns: Interval, Throughput.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+5 -5
View File
@@ -60,11 +60,11 @@ Specifies how often to poll for workspace automated shutdown.
### --wait
| | |
| ----------- | -------------------------------- |
| Type | <code>enum[yes\|no\|auto]</code> |
| Environment | <code>$CODER_SSH_WAIT</code> |
| Default | <code>auto</code> |
| | |
| ----------- | ---------------------------- |
| Type | <code>yes\|no\|auto</code> |
| Environment | <code>$CODER_SSH_WAIT</code> |
| Default | <code>auto</code> |
Specifies whether or not to wait for the startup script to finish executing. Auto means that the agent startup script behavior configured in the workspace template is used.
+10 -10
View File
@@ -22,18 +22,18 @@ coder stat [flags]
### -c, --column
| | |
| ------- | -------------------------------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>host_cpu,host_memory,home_disk,container_cpu,container_memory</code> |
| | |
| ------- | -------------------------------------------------------------------------------- |
| Type | <code>[host cpu\|host memory\|home disk\|container cpu\|container memory]</code> |
| Default | <code>host cpu,host memory,home disk,container cpu,container memory</code> |
Columns to display in table output. Available columns: host cpu, host memory, home disk, container cpu, container memory.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+5 -5
View File
@@ -22,9 +22,9 @@ Force host CPU measurement.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>text</code> |
| | |
| ------- | ----------------------- |
| Type | <code>text\|json</code> |
| Default | <code>text</code> |
Output format. Available formats: text, json.
Output format.
+9 -9
View File
@@ -23,18 +23,18 @@ Path for which to check disk usage.
### --prefix
| | |
| ------- | --------------------------------- |
| Type | <code>enum[Ki\|Mi\|Gi\|Ti]</code> |
| Default | <code>Gi</code> |
| | |
| ------- | --------------------------- |
| Type | <code>Ki\|Mi\|Gi\|Ti</code> |
| Default | <code>Gi</code> |
SI Prefix for disk measurement.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>text</code> |
| | |
| ------- | ----------------------- |
| Type | <code>text\|json</code> |
| Default | <code>text</code> |
Output format. Available formats: text, json.
Output format.
+9 -9
View File
@@ -22,18 +22,18 @@ Force host memory measurement.
### --prefix
| | |
| ------- | --------------------------------- |
| Type | <code>enum[Ki\|Mi\|Gi\|Ti]</code> |
| Default | <code>Gi</code> |
| | |
| ------- | --------------------------- |
| Type | <code>Ki\|Mi\|Gi\|Ti</code> |
| Default | <code>Gi</code> |
SI Prefix for memory measurement.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>text</code> |
| | |
| ------- | ----------------------- |
| Type | <code>text\|json</code> |
| Default | <code>text</code> |
Output format. Available formats: text, json.
Output format.
+6 -6
View File
@@ -70,17 +70,17 @@ Edit the template activity bump - workspaces created from this template will hav
### --autostart-requirement-weekdays
| | |
| ---- | ------------------------- |
| Type | <code>string-array</code> |
| | |
| ---- | ---------------------------------------------------------------------------------- |
| Type | <code>[monday\|tuesday\|wednesday\|thursday\|friday\|saturday\|sunday\|all]</code> |
Edit the template autostart requirement weekdays - workspaces created from this template can only autostart on the given weekdays. To unset this value for the template (and allow autostart on all days), pass 'all'.
### --autostop-requirement-weekdays
| | |
| ---- | ------------------------- |
| Type | <code>string-array</code> |
| | |
| ---- | ----------------------------------------------------------------------------------- |
| Type | <code>[monday\|tuesday\|wednesday\|thursday\|friday\|saturday\|sunday\|none]</code> |
Edit the template autostop requirement weekdays - workspaces created from this template must be restarted on the given weekdays. To unset this value for the template (and disable the autostop requirement for the template), pass 'none'.
+3 -3
View File
@@ -14,8 +14,8 @@ coder templates init [flags] [directory]
### --id
| | |
| ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Type | <code>enum[aws-devcontainer\|aws-linux\|aws-windows\|azure-linux\|do-linux\|docker\|gcp-devcontainer\|gcp-linux\|gcp-vm-container\|gcp-windows\|kubernetes\|nomad-docker\|scratch]</code> |
| | |
| ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Type | <code>aws-devcontainer\|aws-linux\|aws-windows\|azure-linux\|do-linux\|docker\|gcp-devcontainer\|gcp-linux\|gcp-vm-container\|gcp-windows\|kubernetes\|nomad-docker\|scratch</code> |
Specify a given example template by ID.
+10 -10
View File
@@ -18,18 +18,18 @@ coder templates list [flags]
### -c, --column
| | |
| ------- | -------------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>name,organization name,last updated,used by</code> |
| | |
| ------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Type | <code>[name\|created at\|last updated\|organization id\|organization name\|provisioner\|active version id\|used by\|default ttl]</code> |
| Default | <code>name,organization name,last updated,used by</code> |
Columns to display in table output. Available columns: name, created at, last updated, organization id, organization name, provisioner, active version id, used by, default ttl.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+10 -10
View File
@@ -31,18 +31,18 @@ Select which organization (uuid or name) to use.
### -c, --column
| | |
| ------- | ----------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>Name,Created At,Created By,Status,Active</code> |
| | |
| ------- | --------------------------------------------------------------------- |
| Type | <code>[name\|created at\|created by\|status\|active\|archived]</code> |
| Default | <code>name,created at,created by,status,active</code> |
Columns to display in table output. Available columns: name, created at, created by, status, active, archived.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+10 -10
View File
@@ -26,18 +26,18 @@ Specifies whether all users' tokens will be listed or not (must have Owner role
### -c, --column
| | |
| ------- | ---------------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>id,name,last used,expires at,created at</code> |
| | |
| ------- | ----------------------------------------------------------------- |
| Type | <code>[id\|name\|last used\|expires at\|created at\|owner]</code> |
| Default | <code>id,name,last used,expires at,created at</code> |
Columns to display in table output. Available columns: id, name, last used, expires at, created at, owner.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+4 -4
View File
@@ -24,9 +24,9 @@ coder users activate [flags] <username|user_id>
### -c, --column
| | |
| ------- | --------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>username,email,created_at,status</code> |
| | |
| ------- | -------------------------------------------------- |
| Type | <code>[username\|email\|created at\|status]</code> |
| Default | <code>username,email,created at,status</code> |
Specify a column to filter in the table.
+10 -10
View File
@@ -16,18 +16,18 @@ coder users list [flags]
### -c, --column
| | |
| ------- | --------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>username,email,created_at,status</code> |
| | |
| ------- | ------------------------------------------------------------------ |
| Type | <code>[id\|username\|email\|created at\|updated at\|status]</code> |
| Default | <code>username,email,created at,status</code> |
Columns to display in table output. Available columns: id, username, email, created at, updated at, status.
Columns to display in table output.
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+5 -5
View File
@@ -20,9 +20,9 @@ coder users show [flags] <username|user_id|'me'>
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>table</code> |
| | |
| ------- | ------------------------ |
| Type | <code>table\|json</code> |
| Default | <code>table</code> |
Output format. Available formats: table, json.
Output format.
+4 -4
View File
@@ -20,9 +20,9 @@ coder users suspend [flags] <username|user_id>
### -c, --column
| | |
| ------- | --------------------------------------------- |
| Type | <code>string-array</code> |
| Default | <code>username,email,created_at,status</code> |
| | |
| ------- | -------------------------------------------------- |
| Type | <code>[username\|email\|created at\|status]</code> |
| Default | <code>username,email,created at,status</code> |
Specify a column to filter in the table.
+5 -5
View File
@@ -14,9 +14,9 @@ coder version [flags]
### -o, --output
| | |
| ------- | ------------------- |
| Type | <code>string</code> |
| Default | <code>text</code> |
| | |
| ------- | ----------------------- |
| Type | <code>text\|json</code> |
| Default | <code>text</code> |
Output format. Available formats: text, json.
Output format.
+6 -8
View File
@@ -32,7 +32,7 @@ func (r *RootCmd) features() *serpent.Command {
func (r *RootCmd) featuresList() *serpent.Command {
var (
featureColumns = []string{"Name", "Entitlement", "Enabled", "Limit", "Actual"}
featureColumns = []string{"name", "entitlement", "enabled", "limit", "actual"}
columns []string
outputFormat string
)
@@ -85,18 +85,16 @@ func (r *RootCmd) featuresList() *serpent.Command {
{
Flag: "column",
FlagShorthand: "c",
Description: fmt.Sprintf("Specify a column to filter in the table. Available columns are: %s.",
strings.Join(featureColumns, ", "),
),
Default: strings.Join(featureColumns, ","),
Value: serpent.StringArrayOf(&columns),
Description: "Specify columns to filter in the table.",
Default: strings.Join(featureColumns, ","),
Value: serpent.EnumArrayOf(&columns, featureColumns...),
},
{
Flag: "output",
FlagShorthand: "o",
Description: "Output format. Available formats are: table, json.",
Description: "Output format.",
Default: "table",
Value: serpent.StringOf(&outputFormat),
Value: serpent.EnumOf(&outputFormat, "table", "json"),
},
}
+3 -3
View File
@@ -69,10 +69,10 @@ type groupTableRow struct {
// For table output:
Name string `json:"-" table:"name,default_sort"`
DisplayName string `json:"-" table:"display_name"`
OrganizationID uuid.UUID `json:"-" table:"organization_id"`
DisplayName string `json:"-" table:"display name"`
OrganizationID uuid.UUID `json:"-" table:"organization id"`
Members []string `json:"-" table:"members"`
AvatarURL string `json:"-" table:"avatar_url"`
AvatarURL string `json:"-" table:"avatar url"`
}
func groupsToRows(groups ...codersdk.Group) []groupTableRow {
+2 -2
View File
@@ -140,11 +140,11 @@ func (r *RootCmd) licensesList() *serpent.Command {
type tableLicense struct {
ID int32 `table:"id,default_sort"`
UUID uuid.UUID `table:"uuid" format:"uuid"`
UploadedAt time.Time `table:"uploaded_at" format:"date-time"`
UploadedAt time.Time `table:"uploaded at" format:"date-time"`
// Features is the formatted string for the license claims.
// Used for the table view.
Features string `table:"features"`
ExpiresAt time.Time `table:"expires_at" format:"date-time"`
ExpiresAt time.Time `table:"expires at" format:"date-time"`
Trial bool `table:"trial"`
}
+1 -1
View File
@@ -111,7 +111,7 @@ func TestEnterpriseListOrganizationMembers(t *testing.T) {
OrganizationID: owner.OrganizationID,
}, rbac.ScopedRoleOrgAdmin(owner.OrganizationID))
inv, root := clitest.New(t, "organization", "members", "list", "-c", "user_id,username,organization_roles")
inv, root := clitest.New(t, "organization", "members", "list", "-c", "user id,username,organization roles")
clitest.SetupConfig(t, client, root)
buf := new(bytes.Buffer)
+4 -5
View File
@@ -6,12 +6,11 @@ USAGE:
Aliases: ls
OPTIONS:
-c, --column string-array (default: Name,Entitlement,Enabled,Limit,Actual)
Specify a column to filter in the table. Available columns are: Name,
Entitlement, Enabled, Limit, Actual.
-c, --column [name|entitlement|enabled|limit|actual] (default: name,entitlement,enabled,limit,actual)
Specify columns to filter in the table.
-o, --output string (default: table)
Output format. Available formats are: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+4 -5
View File
@@ -9,12 +9,11 @@ OPTIONS:
-O, --org string, $CODER_ORGANIZATION
Select which organization (uuid or name) to use.
-c, --column string-array (default: name,display name,organization id,members,avatar url)
Columns to display in table output. Available columns: name, display
name, organization id, members, avatar url.
-c, --column [name|display name|organization id|members|avatar url] (default: name,display name,organization id,members,avatar url)
Columns to display in table output.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+4 -5
View File
@@ -8,12 +8,11 @@ USAGE:
Aliases: ls
OPTIONS:
-c, --column string-array (default: ID,UUID,Expires At,Uploaded At,Features)
Columns to display in table output. Available columns: id, uuid,
uploaded at, features, expires at, trial.
-c, --column [id|uuid|uploaded at|features|expires at|trial] (default: ID,UUID,Expires At,Uploaded At,Features)
Columns to display in table output.
-o, --output string (default: table)
Output format. Available formats: table, json.
-o, --output table|json (default: table)
Output format.
———
Run `coder --help` for a list of global options.
+1 -1
View File
@@ -442,7 +442,7 @@ func newUpdateProxyResponseFormatter() *updateProxyResponseFormatter {
}),
cliui.JSONFormat(),
// Table formatter expects a slice, make a slice of one.
cliui.ChangeFormatterData(cliui.TableFormat([]codersdk.UpdateWorkspaceProxyResponse{}, []string{"proxy name", "proxy url", "proxy token"}),
cliui.ChangeFormatterData(cliui.TableFormat([]codersdk.UpdateWorkspaceProxyResponse{}, []string{"name", "url", "proxy token"}),
func(data any) (any, error) {
response, ok := data.(codersdk.UpdateWorkspaceProxyResponse)
if !ok {
+1 -1
View File
@@ -117,7 +117,7 @@
name = "coder-${osArch}";
# Updated with ./scripts/update-flake.sh`.
# This should be updated whenever go.mod changes!
vendorHash = "sha256-Zsy0MAXHtcB647JbGjVutPlvTEAaohOdEvyS49SQwKs=";
vendorHash = "sha256-6K1Y61RaSXITD0tr6iW8PHGyf82lkgVQOSCs3K8YcsY=";
proxyVendor = true;
src = ./.;
nativeBuildInputs = with pkgs; [ getopt openssl zstd ];
+8 -5
View File
@@ -171,7 +171,7 @@ require (
go.uber.org/goleak v1.3.1-0.20240429205332-517bace7cc29
go4.org/netipx v0.0.0-20230728180743-ad4cb58a6516
golang.org/x/crypto v0.26.0
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
golang.org/x/mod v0.20.0
golang.org/x/net v0.28.0
golang.org/x/oauth2 v0.22.0
@@ -180,7 +180,7 @@ require (
golang.org/x/term v0.23.0
golang.org/x/text v0.17.0
golang.org/x/tools v0.24.0
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9
google.golang.org/api v0.192.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
@@ -196,12 +196,13 @@ require (
require go.uber.org/mock v0.4.0
require (
github.com/coder/serpent v0.7.0
github.com/coder/serpent v0.7.1-0.20240815055535-d46fb20fa158
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21
github.com/emersion/go-smtp v0.21.2
github.com/gomarkdown/markdown v0.0.0-20231222211730-1d6d20845b47
github.com/google/go-github/v61 v61.0.0
github.com/mocktools/go-smtp-mock/v2 v2.3.0
github.com/natefinch/atomic v1.0.1
)
require (
@@ -216,8 +217,10 @@ require (
github.com/go-jose/go-jose/v4 v4.0.2 // indirect
github.com/go-viper/mapstructure/v2 v2.0.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/pion/transport/v2 v2.0.0 // indirect
github.com/pion/transport/v2 v2.2.10 // indirect
github.com/pion/transport/v3 v3.0.7 // indirect
github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
)
@@ -340,7 +343,7 @@ require (
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mdlayher/genetlink v1.3.2 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/sdnotify v1.0.0 // indirect
+22 -9
View File
@@ -221,8 +221,8 @@ github.com/coder/quartz v0.1.0 h1:cLL+0g5l7xTf6ordRnUMMiZtRE8Sq5LxpghS63vEXrQ=
github.com/coder/quartz v0.1.0/go.mod h1:vsiCc+AHViMKH2CQpGIpFgdHIEQsxwm8yCscqKmzbRA=
github.com/coder/retry v1.5.1 h1:iWu8YnD8YqHs3XwqrqsjoBTAVqT9ml6z9ViJ2wlMiqc=
github.com/coder/retry v1.5.1/go.mod h1:blHMk9vs6LkoRT9ZHyuZo360cufXEhrxqvEzeMtRGoY=
github.com/coder/serpent v0.7.0 h1:zGpD2GlF3lKIVkMjNGKbkip88qzd5r/TRcc30X/SrT0=
github.com/coder/serpent v0.7.0/go.mod h1:REkJ5ZFHQUWFTPLExhXYZ1CaHFjxvGNRlLXLdsI08YA=
github.com/coder/serpent v0.7.1-0.20240815055535-d46fb20fa158 h1:Z+QHBAsvToUfV0UMDnUy8oqdPyrScn5WKV4mx4yNcXY=
github.com/coder/serpent v0.7.1-0.20240815055535-d46fb20fa158/go.mod h1:cZFW6/fP+kE9nd/oRkEHJpG6sXCtQ+AX7WMMEHv0Y3Q=
github.com/coder/ssh v0.0.0-20231128192721-70855dedb788 h1:YoUSJ19E8AtuUFVYBpXuOD6a/zVP3rcxezNsoDseTUw=
github.com/coder/ssh v0.0.0-20231128192721-70855dedb788/go.mod h1:aGQbuCLyhRLMzZF067xc84Lh7JDs1FKwCmF1Crl9dxQ=
github.com/coder/tailscale v1.1.1-0.20240702054557-aa558fbe5374 h1:a5Eg7D5e2oAc0tN56ee4yxtiTo76ztpRlk6geljaZp8=
@@ -698,8 +698,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mdlayher/genetlink v1.3.2 h1:KdrNKe+CTu+IbZnm/GVUMXSqBBLqcGpRDa0xkQy56gw=
@@ -718,6 +718,8 @@ github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM=
github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
@@ -754,6 +756,8 @@ github.com/muesli/smartcrop v0.3.0 h1:JTlSkmxWg/oQ1TcLDoypuirdE8Y/jzNirQeLkxpA6O
github.com/muesli/smartcrop v0.3.0/go.mod h1:i2fCI/UorTfgEpPPLWiFBv4pye+YAG78RwcQLUkocpI=
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a h1:2MaM6YC3mGu54x+RKAA6JiFFHlHDY1UbkxqppT7wYOg=
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a/go.mod h1:hxSnBBYLK21Vtq/PHd0S2FYCxBXzBua8ov5s1RobyRQ=
github.com/natefinch/atomic v1.0.1 h1:ZPYKxkqQOx3KZ+RsbnP/YsgvxWQPGxjC0oBt2AhwV0A=
github.com/natefinch/atomic v1.0.1/go.mod h1:N/D/ELrljoqDyT3rZrsUmtsuzvHkeB/wWjHV22AZRbM=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/niklasfasching/go-org v1.7.0 h1:vyMdcMWWTe/XmANk19F4k8XGBYg0GQ/gJGMimOjGMek=
github.com/niklasfasching/go-org v1.7.0/go.mod h1:WuVm4d45oePiE0eX25GqTDQIt/qPW1T9DGkRscqLW5o=
@@ -792,8 +796,11 @@ github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2
github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ=
github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
github.com/pion/transport/v2 v2.0.0 h1:bsMYyqHCbkvHwj+eNCFBuxtlKndKfyGI2vaQmM3fIE4=
github.com/pion/transport/v2 v2.0.0/go.mod h1:HS2MEBJTwD+1ZI2eSXSvHJx/HnzQqRy2/LXxt6eVMHc=
github.com/pion/transport/v2 v2.2.10 h1:ucLBLE8nuxiHfvkFKnkDQRYWYfp8ejf4YBOPfaQpw6Q=
github.com/pion/transport/v2 v2.2.10/go.mod h1:sq1kSLWs+cHW9E+2fJP95QudkzbK7wscs8yYgQToO5E=
github.com/pion/transport/v3 v3.0.7 h1:iRbMH05BzSNwhILHoBoAPxoB9xQgOaJk+591KC9P1o0=
github.com/pion/transport/v3 v3.0.7/go.mod h1:YleKiTZ4vqNxVwh77Z0zytYi7rXHl7j6uPLGhhz9rwo=
github.com/pion/udp v0.1.4 h1:OowsTmu1Od3sD6i3fQUJxJn2fEvJO6L1TidgadtbTI8=
github.com/pion/udp v0.1.4/go.mod h1:G8LDo56HsFwC24LIcnT4YIDU5qcB6NepqqjP0keL2us=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
@@ -950,6 +957,7 @@ github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vb
github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/wagslane/go-password-validator v0.3.0 h1:vfxOPzGHkz5S146HDpavl0cw1DSVP061Ry2PX0/ON6I=
github.com/wagslane/go-password-validator v0.3.0/go.mod h1:TI1XJ6T5fRdRnHqHt14pvy1tNVnrwe7m3/f1f2fDphQ=
github.com/wlynxg/anet v0.0.3/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
@@ -1040,12 +1048,13 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -1079,6 +1088,7 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -1132,6 +1142,7 @@ golang.org/x/sys v0.4.1-0.20230131160137-e7d7f63158de/go.mod h1:oPkhp1MJrh7nUepC
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
@@ -1143,6 +1154,7 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
@@ -1155,6 +1167,7 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
@@ -1179,8 +1192,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 h1:LLhsEBxRTBLuKlQxFBYUOU8xyFgXv6cOTp2HASDlsDk=
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg=
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI=
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 h1:CawjfCvYQH2OU3/TnxLx97WDSUDRABfT18pCOYwc2GE=
+1 -1
View File
@@ -43,7 +43,7 @@ Aliases:
### {{ with $opt.FlagShorthand}}-{{ . }}, {{end}}--{{ $opt.Flag }}
{{" "}}
{{ tableHeader }}
| Type | {{ $opt.Value.Type | wrapCode }} |
| Type | {{ typeHelper $opt | wrapCode }} |
{{- with $opt.Env }}
| Environment | {{ (print "$" .) | wrapCode }} |
{{- end }}
+10
View File
@@ -62,6 +62,16 @@ func init() {
return `| | |
| --- | --- |`
},
"typeHelper": func(opt *serpent.Option) string {
switch v := opt.Value.(type) {
case *serpent.Enum:
return strings.Join(v.Choices, "\\|")
case *serpent.EnumArray:
return fmt.Sprintf("[%s]", strings.Join(v.Choices, "\\|"))
default:
return v.Type()
}
},
},
).Parse(strings.TrimSpace(commandTemplateRaw)),
)