@@ -173,8 +173,8 @@ func (c *Command) call(req *Request, re ResponseEmitter, env Environment) error
173173 return cmd .Run (req , re , env )
174174}
175175
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.
178178func (c * Command ) Resolve (pth []string ) ([]* Command , error ) {
179179 cmds := make ([]* Command , len (pth )+ 1 )
180180 cmds [0 ] = c
@@ -233,6 +233,10 @@ func (c *Command) GetOptions(path []string) (map[string]Option, error) {
233233// DebugValidate checks if the command tree is well-formed.
234234//
235235// 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.
236240func (c * Command ) DebugValidate () map [string ][]error {
237241 errs := make (map [string ][]error )
238242 var visit func (path string , cm * Command )
@@ -348,6 +352,7 @@ func (c *Command) CheckArguments(req *Request) error {
348352 return nil
349353}
350354
355+ // TODO: no documentation; [54dbca2b-17f2-42a8-af93-c8d713866138]
351356type CommandVisitor func (* Command )
352357
353358// Walks tree of all subcommands (including this one)
@@ -358,6 +363,7 @@ func (c *Command) Walk(visitor CommandVisitor) {
358363 }
359364}
360365
366+ // TODO: no documentation; [54dbca2b-17f2-42a8-af93-c8d713866138]
361367func (c * Command ) ProcessHelp () {
362368 c .Walk (func (cm * Command ) {
363369 ht := & cm .Helptext
@@ -367,6 +373,7 @@ func (c *Command) ProcessHelp() {
367373 })
368374}
369375
376+ // TODO: no documentation; [54dbca2b-17f2-42a8-af93-c8d713866138]
370377func ClientError (msg string ) error {
371378 return & Error {Code : ErrClient , Message : msg }
372379}
0 commit comments