(cmd string)
| 31 | } |
| 32 | |
| 33 | func ParseSimpleCommand(cmd string) (env, args []string, err error) { |
| 34 | tokens, err := Tokenize(cmd) |
| 35 | if err != nil { |
| 36 | return |
| 37 | } |
| 38 | |
| 39 | for _, t := range tokens { |
| 40 | if t.IsScary { |
| 41 | err = errCommandNotSimple("command is not simple", cmd) |
| 42 | args = nil |
| 43 | env = nil |
| 44 | return |
| 45 | } |
| 46 | if isVariableAssignment(t.Decoded) && len(args) == 0 { |
| 47 | env = append(env, t.Decoded) |
| 48 | } else { |
| 49 | args = append(args, t.Decoded) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | if len(args) == 0 { |
| 54 | err = errCommandNotSimple("nothing to run", cmd) |
| 55 | args = nil |
| 56 | env = nil |
| 57 | return |
| 58 | } |
| 59 | |
| 60 | return |
| 61 | } |
no test coverage detected