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

Method version

cli/version.go:63–90  ·  view source on GitHub ↗

version prints the coder version

(versionInfo func() *versionInfo)

Source from the content-addressed store, hash-verified

61
62// version prints the coder version
63func (*RootCmd) version(versionInfo func() *versionInfo) *serpent.Command {
64 var (
65 formatter = cliui.NewOutputFormatter(
66 cliui.TextFormat(),
67 cliui.JSONFormat(),
68 )
69 vi = versionInfo()
70 )
71
72 cmd := &serpent.Command{
73 Use: "version",
74 Short: "Show coder version",
75 Options: serpent.OptionSet{},
76 Handler: func(inv *serpent.Invocation) error {
77 out, err := formatter.Format(inv.Context(), vi)
78 if err != nil {
79 return err
80 }
81
82 _, err = fmt.Fprintln(inv.Stdout, out)
83 return err
84 },
85 }
86
87 formatter.AttachOptions(&cmd.Options)
88
89 return cmd
90}

Callers 2

CoreSubcommandsMethod · 0.95
CommandMethod · 0.95

Calls 7

NewOutputFormatterFunction · 0.92
TextFormatFunction · 0.92
JSONFormatFunction · 0.92
versionInfoStruct · 0.85
FormatMethod · 0.65
ContextMethod · 0.65
AttachOptionsMethod · 0.65

Tested by

no test coverage detected