summaryrefslogtreecommitdiff
path: root/internal/lcontext
diff options
context:
space:
mode:
authorPaul Buetow <git@mx.buetow.org>2021-03-23 09:37:02 +0000
committerPaul Buetow <git@mx.buetow.org>2021-03-23 20:12:09 +0000
commit2b47630c2f68794a95d5065a7989d489990f7a19 (patch)
tree389166c157ebc7cec690a967b02255d9337c6988 /internal/lcontext
parentd6dd896805faa074960f17bd1e8c516420e27f0d (diff)
context aware grep with -max -after and -before not work
Diffstat (limited to 'internal/lcontext')
-rw-r--r--internal/lcontext/lcontext.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/lcontext/lcontext.go b/internal/lcontext/lcontext.go
index bd51d94..89cb7c3 100644
--- a/internal/lcontext/lcontext.go
+++ b/internal/lcontext/lcontext.go
@@ -6,3 +6,17 @@ type LContext struct {
BeforeContext int
MaxCount int
}
+
+// Has returns true if it has any parameter set.
+func (c LContext) Has() bool {
+ if c.AfterContext > 0 {
+ return true
+ }
+ if c.BeforeContext > 0 {
+ return true
+ }
+ if c.MaxCount > 0 {
+ return true
+ }
+ return false
+}