ParseSSHArgs parses the given array of arguments into two distinct slices of flags and command. The ssh command syntax is: ssh [flags] user@host command [args...] There is no way to specify the user@host destination as a flag. Unfortunately, that means we need to know which user-provided words are S
(args []string)
| 98 | // them before or after the destination, and that means we need to know all |
| 99 | // the flags and their arities. |
| 100 | func ParseSSHArgs(args []string) (cmdArgs, command []string, err error) { |
| 101 | return parseArgs(args, "bcDeFIiLlmOopRSWw") |
| 102 | } |
| 103 | |
| 104 | // newSCPCommand populates an exec.Cmd to run an scp command for the files specified in cmdArgs. |
| 105 | // cmdArgs is parsed such that scp flags precede the files to copy in the command. |