Add configuration path discovery
This commit is contained in:
10
identity.go
10
identity.go
@@ -52,12 +52,22 @@ type Invocation struct {
|
||||
reporter *Reporter
|
||||
enteredPath string
|
||||
canonicalPath string
|
||||
renderHelp func() Outcome
|
||||
}
|
||||
|
||||
// Reporter returns the reporting facility supplied for this invocation. A
|
||||
// manually constructed Invocation has no reporter.
|
||||
func (inv Invocation) Reporter() *Reporter { return inv.reporter }
|
||||
|
||||
// Help renders the selected command's help through this invocation's output.
|
||||
// It returns an operational failure when the invocation has no help renderer.
|
||||
func (inv Invocation) Help() Outcome {
|
||||
if inv.renderHelp == nil {
|
||||
return Failure("Command help is unavailable.")
|
||||
}
|
||||
return inv.renderHelp()
|
||||
}
|
||||
|
||||
// EnteredPath returns the command path used to invoke the selected command,
|
||||
// excluding the executable name, flags, and operands. It is empty for an
|
||||
// Invocation that was not created by command execution.
|
||||
|
||||
Reference in New Issue
Block a user