summaryrefslogtreecommitdiff
path: root/internal/lcontext
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2021-10-15 12:38:39 +0300
committerPaul Buetow <pbuetow@mimecast.com>2021-10-15 12:38:39 +0300
commit1edc1469024d3cb74473bd99959d5d1068229c39 (patch)
tree72618e384626d9fc368994e3f24be9e9892d0610 /internal/lcontext
parent4e1b7f6ff7e3f10bda852da90f7b62d5dbccd455 (diff)
parentc0332e8fa13f4939de17c856b2e71fd093847253 (diff)
merge from github.com/snonux/dtail
Diffstat (limited to 'internal/lcontext')
-rw-r--r--internal/lcontext/lcontext.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/lcontext/lcontext.go b/internal/lcontext/lcontext.go
new file mode 100644
index 0000000..183ceb5
--- /dev/null
+++ b/internal/lcontext/lcontext.go
@@ -0,0 +1,22 @@
+package lcontext
+
+// LContext stands for line context (used by context aware grep queries e.g.)
+type LContext struct {
+ AfterContext int
+ 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
+}