parseNFSClientDir parses the --nfs-client-dir flag value. Expected format: @ :
(val string)
| 645 | // parseNFSClientDir parses the --nfs-client-dir flag value. |
| 646 | // Expected format: <mount_point>@<server>:<export_path> |
| 647 | func 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 | |
| 658 | func shellQuote(value string) string { |
| 659 | return "'" + strings.ReplaceAll(value, "'", "'\\''") + "'" |
no outgoing calls