mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-27 05:17:49 +08:00
fix code-climate issues
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
parent
61b1d2f258
commit
31bb782e77
@ -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 {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user