MCPcopy Index your code
hub / github.com/celer-pkg/celer / parseNFSClientDir

Function parseNFSClientDir

pkgcache/cache_setup.go:647–656  ·  view source on GitHub ↗

parseNFSClientDir parses the --nfs-client-dir flag value. Expected format: @ :

(val string)

Source from the content-addressed store, hash-verified

645// parseNFSClientDir parses the --nfs-client-dir flag value.
646// Expected format: <mount_point>@<server>:<export_path>
647func parseNFSClientDir(val string) (mountPoint, serverExport string, err error) {
648 parts := strings.SplitN(val, "@", 2)
649 if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
650 return "", "", fmt.Errorf("--nfs-client-dir format: <mount_point>@<server>:<export_path>")
651 }
652 if !strings.Contains(parts[1], ":") {
653 return "", "", fmt.Errorf("--nfs-client-dir: server export must be in <server>:<path> format")
654 }
655 return parts[0], parts[1], nil
656}
657
658func shellQuote(value string) string {
659 return "'" + strings.ReplaceAll(value, "'", "'\\''") + "'"

Callers 3

TestParseNFSClientDirFunction · 0.85
SetupMethod · 0.85
RemoveMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestParseNFSClientDirFunction · 0.68