@@ -173,8 +173,8 @@ func (c *Command) call(req *Request, re ResponseEmitter, env Environment) error
173
173
return cmd .Run (req , re , env )
174
174
}
175
175
176
- // Resolve returns the subcommands at the given path
177
- // The returned set of subcommands starts with this command and therefore is always at least size 1
176
+ // Resolve returns the subcommands at the given path.
177
+ // The returned set of subcommands starts with this command and therefore is always at least size 1.
178
178
func (c * Command ) Resolve (pth []string ) ([]* Command , error ) {
179
179
cmds := make ([]* Command , len (pth )+ 1 )
180
180
cmds [0 ] = c
@@ -233,6 +233,10 @@ func (c *Command) GetOptions(path []string) (map[string]Option, error) {
233
233
// DebugValidate checks if the command tree is well-formed.
234
234
//
235
235
// This operation is slow and should be called from tests only.
236
+ //
237
+ // TODO: review this; I don't see any reason this needs to be attached to all `Command`s
238
+ // rather than being a function which takes in `Command`.
239
+ // ValidateCommand(cmd)[]error|<-chan error; called from tests only.
236
240
func (c * Command ) DebugValidate () map [string ][]error {
237
241
errs := make (map [string ][]error )
238
242
var visit func (path string , cm * Command )
@@ -348,6 +352,7 @@ func (c *Command) CheckArguments(req *Request) error {
348
352
return nil
349
353
}
350
354
355
+ // TODO: no documentation; [54dbca2b-17f2-42a8-af93-c8d713866138]
351
356
type CommandVisitor func (* Command )
352
357
353
358
// Walks tree of all subcommands (including this one)
@@ -358,6 +363,7 @@ func (c *Command) Walk(visitor CommandVisitor) {
358
363
}
359
364
}
360
365
366
+ // TODO: no documentation; [54dbca2b-17f2-42a8-af93-c8d713866138]
361
367
func (c * Command ) ProcessHelp () {
362
368
c .Walk (func (cm * Command ) {
363
369
ht := & cm .Helptext
@@ -367,6 +373,7 @@ func (c *Command) ProcessHelp() {
367
373
})
368
374
}
369
375
376
+ // TODO: no documentation; [54dbca2b-17f2-42a8-af93-c8d713866138]
370
377
func ClientError (msg string ) error {
371
378
return & Error {Code : ErrClient , Message : msg }
372
379
}
0 commit comments