Skip to content

Commit 94118d5

Browse files
committed
Remove diffs for the cli, moving to another branch
1 parent 4116ad8 commit 94118d5

File tree

5 files changed

+9
-37
lines changed

5 files changed

+9
-37
lines changed

cli/cliui/parameter.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ func RichParameter(inv *serpent.Invocation, templateVersionParameter codersdk.Te
4343
return "", err
4444
}
4545

46-
values, err := MultiSelect(inv, MultiSelectOptions{
47-
Options: options,
48-
Defaults: options,
49-
})
46+
values, err := MultiSelect(inv, options)
5047
if err == nil {
5148
v, err := json.Marshal(&values)
5249
if err != nil {

cli/cliui/select.go

+6-16
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func init() {
2121
{{- .CurrentOpt.Value}}
2222
{{- color "reset"}}
2323
{{end}}
24-
{{- if .Message }}{{- color "default+hb"}}{{ .Message }}{{ .FilterMessage }}{{color "reset"}}{{ end }}
24+
2525
{{- if not .ShowAnswer }}
2626
{{- if .Config.Icons.Help.Text }}
2727
{{- if .FilterMessage }}{{ "Search:" }}{{ .FilterMessage }}
@@ -44,20 +44,18 @@ func init() {
4444
{{- " "}}{{- .CurrentOpt.Value}}
4545
{{end}}
4646
{{- if .ShowHelp }}{{- color .Config.Icons.Help.Format }}{{ .Config.Icons.Help.Text }} {{ .Help }}{{color "reset"}}{{"\n"}}{{end}}
47-
{{- if .Message }}{{- color "default+hb"}}{{ .Message }}{{ .FilterMessage }}{{color "reset"}}{{ end }}
4847
{{- if not .ShowAnswer }}
4948
{{- "\n"}}
5049
{{- range $ix, $option := .PageEntries}}
5150
{{- template "option" $.IterateOption $ix $option}}
5251
{{- end}}
53-
{{- end }}`
52+
{{- end}}`
5453
}
5554

5655
type SelectOptions struct {
5756
Options []string
5857
// Default will be highlighted first if it's a valid option.
5958
Default string
60-
Message string
6159
Size int
6260
HideSearch bool
6361
}
@@ -124,7 +122,6 @@ func Select(inv *serpent.Invocation, opts SelectOptions) (string, error) {
124122
Options: opts.Options,
125123
Default: defaultOption,
126124
PageSize: opts.Size,
127-
Message: opts.Message,
128125
}, &value, survey.WithIcons(func(is *survey.IconSet) {
129126
is.Help.Text = "Type to search"
130127
if opts.HideSearch {
@@ -141,22 +138,15 @@ func Select(inv *serpent.Invocation, opts SelectOptions) (string, error) {
141138
return value, err
142139
}
143140

144-
type MultiSelectOptions struct {
145-
Message string
146-
Options []string
147-
Defaults []string
148-
}
149-
150-
func MultiSelect(inv *serpent.Invocation, opts MultiSelectOptions) ([]string, error) {
141+
func MultiSelect(inv *serpent.Invocation, items []string) ([]string, error) {
151142
// Similar hack is applied to Select()
152143
if flag.Lookup("test.v") != nil {
153-
return opts.Defaults, nil
144+
return items, nil
154145
}
155146

156147
prompt := &survey.MultiSelect{
157-
Message: opts.Message,
158-
Options: opts.Options,
159-
Default: opts.Defaults,
148+
Options: items,
149+
Default: items,
160150
}
161151

162152
var values []string

cli/cliui/select_test.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ func newMultiSelect(ptty *ptytest.PTY, items []string) ([]string, error) {
107107
var values []string
108108
cmd := &serpent.Command{
109109
Handler: func(inv *serpent.Invocation) error {
110-
selectedItems, err := cliui.MultiSelect(inv, cliui.MultiSelectOptions{
111-
Options: items,
112-
Defaults: items,
113-
})
110+
selectedItems, err := cliui.MultiSelect(inv, items)
114111
if err == nil {
115112
values = selectedItems
116113
}

enterprise/coderd/roles_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func TestCustomOrganizationRole(t *testing.T) {
166166
newRole.SitePermissions = nil
167167
newRole.OrganizationPermissions = nil
168168
newRole.UserPermissions = nil
169-
role, err = owner.PatchOrganizationRole(ctx, first.OrganizationID, newRole)
169+
_, err = owner.PatchOrganizationRole(ctx, first.OrganizationID, newRole)
170170
require.NoError(t, err, "upsert role with override")
171171

172172
// The role should no longer have template perms

scripts/rbacgen/codersdk.gotmpl

-12
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,3 @@ const (
1616
{{ $element.Enum }} RBACAction = "{{ $element.Value }}"
1717
{{- end }}
1818
)
19-
20-
// RBACResourceActions is the mapping of resources to which actions are valid for
21-
// said resource type.
22-
var RBACResourceActions = map[RBACResource][]RBACAction{
23-
{{- range $element := . }}
24-
Resource{{ pascalCaseName $element.FunctionName }}: []RBACAction{
25-
{{- range $actionValue, $_ := $element.Actions }}
26-
{{- actionEnum $actionValue -}},
27-
{{- end -}}
28-
},
29-
{{- end }}
30-
}

0 commit comments

Comments
 (0)