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

Function initStatterMW

cli/stat.go:15–27  ·  view source on GitHub ↗
(tgt **clistat.Statter, fs afero.Fs)

Source from the content-addressed store, hash-verified

13)
14
15func initStatterMW(tgt **clistat.Statter, fs afero.Fs) serpent.MiddlewareFunc {
16 return func(next serpent.HandlerFunc) serpent.HandlerFunc {
17 return func(i *serpent.Invocation) error {
18 var err error
19 stat, err := clistat.New(clistat.WithFS(fs))
20 if err != nil {
21 return xerrors.Errorf("initialize workspace stats collector: %w", err)
22 }
23 *tgt = stat
24 return next(i)
25 }
26 }
27}
28
29func (r *RootCmd) stat() *serpent.Command {
30 var (

Callers 4

statMethod · 0.85
statCPUMethod · 0.85
statMemMethod · 0.85
statDiskMethod · 0.85

Calls 2

NewMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected