MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / resolveArgs

Method resolveArgs

modules/clibridge/clibridge.go:168–188  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

166}
167
168func (m *CLIBridgeModule) resolveArgs(args []string) ([]string, error) {
169 if len(args) == 0 {
170 return args, nil
171 }
172
173 resolved := make([]string, len(args))
174
175 for i, arg := range args {
176 if strings.HasPrefix(arg, `-`) {
177 resolved[i] = arg
178 continue
179 }
180
181 if !m.isPathAllowed(arg) {
182 return nil, fmt.Errorf("path %q is not within allowed paths", arg)
183 }
184 resolved[i] = arg
185 }
186
187 return resolved, nil
188}
189
190func (m *CLIBridgeModule) cliCommand(rest string, user *users.UserRecord, room *rooms.Room, flags events.EventFlag) (bool, error) {
191 if !m.isEnabled() {

Callers 1

onCLIRequestMethod · 0.95

Calls 1

isPathAllowedMethod · 0.95

Tested by

no test coverage detected