diff options
| author | Eyal Posener <[email protected]> | 2018-10-19 20:18:15 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-10-19 20:18:15 +0300 |
| commit | ffc2cf5e958af5ac4156a886153c7cadd24a521a (patch) | |
| tree | 1b4936b7ce044bd52e1ae3f9e4cf7c41a2a89a35 /args.go | |
| parent | 0d98d7ee195f007b3453c002780ed80c76e7c806 (diff) | |
| parent | 5fdb1adfd7447867ac25c2dbafbe577ccc6d9e7f (diff) | |
Merge pull request #73 from posener/point
Add support for CMP_POINT
Diffstat (limited to 'args.go')
| -rw-r--r-- | args.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -57,11 +57,20 @@ func newArgs(line string) Args { } } +// splitFields returns a list of fields from the given command line. +// If the last character is space, it appends an empty field in the end +// indicating that the field before it was completed. +// If the last field is of the form "a=b", it splits it to two fields: "a", "b", +// So it can be completed. func splitFields(line string) []string { parts := strings.Fields(line) + + // Add empty field if the last field was completed. if len(line) > 0 && unicode.IsSpace(rune(line[len(line)-1])) { parts = append(parts, "") } + + // Treat the last field if it is of the form "a=b" parts = splitLastEqual(parts) return parts } |
