diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/posener/complete/args.go | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/posener/complete/args.go')
-rw-r--r-- | vendor/github.com/posener/complete/args.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/github.com/posener/complete/args.go b/vendor/github.com/posener/complete/args.go index 1ba4d69..17ab2c6 100644 --- a/vendor/github.com/posener/complete/args.go +++ b/vendor/github.com/posener/complete/args.go | |||
@@ -57,11 +57,20 @@ func newArgs(line string) Args { | |||
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | // splitFields returns a list of fields from the given command line. | ||
61 | // If the last character is space, it appends an empty field in the end | ||
62 | // indicating that the field before it was completed. | ||
63 | // If the last field is of the form "a=b", it splits it to two fields: "a", "b", | ||
64 | // So it can be completed. | ||
60 | func splitFields(line string) []string { | 65 | func splitFields(line string) []string { |
61 | parts := strings.Fields(line) | 66 | parts := strings.Fields(line) |
67 | |||
68 | // Add empty field if the last field was completed. | ||
62 | if len(line) > 0 && unicode.IsSpace(rune(line[len(line)-1])) { | 69 | if len(line) > 0 && unicode.IsSpace(rune(line[len(line)-1])) { |
63 | parts = append(parts, "") | 70 | parts = append(parts, "") |
64 | } | 71 | } |
72 | |||
73 | // Treat the last field if it is of the form "a=b" | ||
65 | parts = splitLastEqual(parts) | 74 | parts = splitLastEqual(parts) |
66 | return parts | 75 | return parts |
67 | } | 76 | } |