summaryrefslogtreecommitdiff
path: root/internal/lcontext
diff options
context:
space:
mode:
authorPaul Buetow <35781042+pbuetow@users.noreply.github.com>2021-03-29 17:49:16 +0100
committerGitHub <noreply@github.com>2021-03-29 17:49:16 +0100
commit9a467da883976c74d231ea9c7773430f583bab98 (patch)
tree4e75a996ef44bc5adc771c318753b0c4ad934269 /internal/lcontext
parente811d1725ee5f931ece6fac01db70227b0fc8a7a (diff)
parent93fce245564ffde20c3e5113757bc65672f69ed5 (diff)
Merge pull request #22 from snonux/develop
Add context awareness to dgrep
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..89cb7c3
--- /dev/null
+++ b/internal/lcontext/lcontext.go
@@ -0,0 +1,22 @@
+package lcontext
+
+// LContext stands for line context and is here to help filtering out only specific lines.
+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
+}