MCPcopy Index your code
hub / github.com/coder/coder / AttachOptions

Method AttachOptions

cli/cliui/output.go:53–72  ·  view source on GitHub ↗

AttachOptions attaches the --output flag to the given command, and any additional flags required by the output formatters.

(opts *serpent.OptionSet)

Source from the content-addressed store, hash-verified

51// AttachOptions attaches the --output flag to the given command, and any
52// additional flags required by the output formatters.
53func (f *OutputFormatter) AttachOptions(opts *serpent.OptionSet) {
54 for _, format := range f.formats {
55 format.AttachOptions(opts)
56 }
57
58 formatNames := make([]string, 0, len(f.formats))
59 for _, format := range f.formats {
60 formatNames = append(formatNames, format.ID())
61 }
62
63 *opts = append(*opts,
64 serpent.Option{
65 Flag: "output",
66 FlagShorthand: "o",
67 Default: f.formats[0].ID(),
68 Value: serpent.EnumOf(&f.formatID, formatNames...),
69 Description: "Output format.",
70 },
71 )
72}
73
74// Format formats the given data using the format specified by the --output
75// flag. If the flag is not set, the default format is used.

Callers 15

templatePresetsListMethod · 0.95
showOrganizationRolesMethod · 0.95
templateListMethod · 0.95
whoamiMethod · 0.95
taskLogsMethod · 0.95
userListMethod · 0.95
userSingleMethod · 0.95
userOIDCClaimsMethod · 0.95
templateVersionsListMethod · 0.95
listOrganizationsMethod · 0.95

Calls 2

AttachOptionsMethod · 0.65
IDMethod · 0.65

Tested by 1

Test_OutputFormatterFunction · 0.76