MCPcopy
hub / github.com/caddyserver/caddy / splitModule

Function splitModule

cmd/packagesfuncs.go:49–66  ·  view source on GitHub ↗
(arg string)

Source from the content-addressed store, hash-verified

47}
48
49func splitModule(arg string) (module, version string, err error) {
50 const versionSplit = "@"
51
52 // accommodate module paths that have @ in them, but we can only tolerate that if there's also
53 // a version, otherwise we don't know if it's a version separator or part of the file path
54 lastVersionSplit := strings.LastIndex(arg, versionSplit)
55 if lastVersionSplit < 0 {
56 module = arg
57 } else {
58 module, version = arg[:lastVersionSplit], arg[lastVersionSplit+1:]
59 }
60
61 if module == "" {
62 err = fmt.Errorf("module name is required")
63 }
64
65 return module, version, err
66}
67
68func cmdAddPackage(fl Flags) (int, error) {
69 if len(fl.Args()) == 0 {

Callers 2

cmdAddPackageFunction · 0.85
cmdRemovePackageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected