summaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
Diffstat (limited to 'args.go')
-rw-r--r--args.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/args.go b/args.go
index 16e5ab3..3340285 100644
--- a/args.go
+++ b/args.go
@@ -85,16 +85,17 @@ func splitLastEqual(line []string) []string {
return append(line[:len(line)-1], parts...)
}
+// from returns a copy of Args of all arguments after the i'th argument.
func (a Args) from(i int) Args {
- if i > len(a.All) {
- i = len(a.All)
+ if i >= len(a.All) {
+ i = len(a.All) - 1
}
- a.All = a.All[i:]
+ a.All = a.All[i+1:]
- if i > len(a.Completed) {
- i = len(a.Completed)
+ if i >= len(a.Completed) {
+ i = len(a.Completed) - 1
}
- a.Completed = a.Completed[i:]
+ a.Completed = a.Completed[i+1:]
return a
}