fix code-climate issues

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
Steven Allen 2018-01-23 20:04:45 -08:00
parent 61b1d2f258
commit 31bb782e77
2 changed files with 6 additions and 0 deletions

View File

@ -45,6 +45,8 @@ func (me *MarshalerEncoder) Encode(v interface{}) error {
return err
}
// OldContext tries to cast the environment as a legacy command context,
// returning nil on failure.
func OldContext(env interface{}) *oldcmds.Context {
ctx, ok := env.(*oldcmds.Context)
if !ok {

View File

@ -134,10 +134,14 @@ func commandsOption(cctx oldcmds.Context, command *cmds.Command) ServeOption {
}
}
// CommandsOption constructs a ServerOption for hooking the commands into the
// HTTP server.
func CommandsOption(cctx oldcmds.Context) ServeOption {
return commandsOption(cctx, corecommands.Root)
}
// CommandsOption constructs a ServerOption for hooking the read-only commands
// into the HTTP server.
func CommandsROOption(cctx oldcmds.Context) ServeOption {
return commandsOption(cctx, corecommands.RootRO)
}