summaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-11 20:28:31 +0300
committerEyal Posener <[email protected]>2017-05-11 20:33:29 +0300
commit967bae76f3132c210e6275653f9b603593973858 (patch)
tree0f71371443e6d5dde4fcf9e49c63b9afbab28a55 /args.go
parenta28594d28ea9a838f174641a411fd537c2c495b9 (diff)
Add Predictor interface
Diffstat (limited to 'args.go')
-rw-r--r--args.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/args.go b/args.go
index bb45d1c..86dd41a 100644
--- a/args.go
+++ b/args.go
@@ -1,25 +1,26 @@
package complete
-type args struct {
- all []string
- completed []string
- beingTyped string
- lastCompleted string
+// Args describes command line arguments
+type Args struct {
+ All []string
+ Completed []string
+ Last string
+ LastCompleted string
}
-func newArgs(line []string) args {
+func newArgs(line []string) Args {
completed := removeLast(line)
- return args{
- all: line[1:],
- completed: completed,
- beingTyped: last(line),
- lastCompleted: last(completed),
+ return Args{
+ All: line[1:],
+ Completed: completed,
+ Last: last(line),
+ LastCompleted: last(completed),
}
}
-func (a args) from(i int) args {
- a.all = a.all[i:]
- a.completed = a.completed[i:]
+func (a Args) from(i int) Args {
+ a.All = a.All[i:]
+ a.Completed = a.Completed[i:]
return a
}