fix code-climate issues
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Jan 23, 2018 at 20:04 UTC
31bb782e77bba47c04f65910a280d005e409e96d
2 files changed
+6
commands/legacy/legacy.go
+2
@@ -45,6 +45,8 @@ func (me *MarshalerEncoder) Encode(v interface{}) error {
45
return err
46
}
47
48
+// OldContext tries to cast the environment as a legacy command context,
49
+// returning nil on failure.
50
func OldContext(env interface{}) *oldcmds.Context {
51
ctx, ok := env.(*oldcmds.Context)
52
if !ok {
core/corehttp/commands.go
+4
@@ -134,10 +134,14 @@ func commandsOption(cctx oldcmds.Context, command *cmds.Command) ServeOption {
134
}
135
}
136
137
+// CommandsOption constructs a ServerOption for hooking the commands into the
138
+// HTTP server.
139
func CommandsOption(cctx oldcmds.Context) ServeOption {
140
return commandsOption(cctx, corecommands.Root)
141
}
142
143
+// CommandsOption constructs a ServerOption for hooking the read-only commands
144
+// into the HTTP server.
145
func CommandsROOption(cctx oldcmds.Context) ServeOption {
146
return commandsOption(cctx, corecommands.RootRO)
147
}