fix(cli): clistat: accept positional arg for stat disk cmd (#8911)

This commit is contained in:
Cian Johnston
2023-08-07 16:26:16 +01:00
committed by GitHub
parent 6ded748989
commit 82e0e2e43c
2 changed files with 20 additions and 0 deletions
+8
View File
@@ -233,8 +233,16 @@ func (*RootCmd) statDisk(s *clistat.Statter) *clibase.Cmd {
},
Handler: func(inv *clibase.Invocation) error {
pfx := clistat.ParsePrefix(prefixArg)
// Users may also call `coder stat disk <path>`.
if len(inv.Args) > 0 {
pathArg = inv.Args[0]
}
ds, err := s.Disk(pfx, pathArg)
if err != nil {
if os.IsNotExist(err) {
// fmt.Errorf produces a more concise error.
return fmt.Errorf("not found: %q", pathArg)
}
return err
}