summaryrefslogtreecommitdiff
path: root/internal/lcontext
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-10-13 21:10:28 +0300
committerPaul Buetow <paul@buetow.org>2021-10-14 20:11:23 +0300
commit1dead22129a26e4f532e68c2c63fe4122b519506 (patch)
treeb5ab02d2400767410b8dec5183aa9f83d092f0d4 /internal/lcontext
parent5f3e6b8569b5b71853208949506bbcd3c44488b5 (diff)
Merging grep context from master
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
+}