id = "cgrep"
name = "CGrep"
homepage = "https://github.com/awgn/cgrep"
description = "Context-aware grep for source codes."
executables = ["cgrep"]
[dotfiles]
paths = ["~/.cgreprc", "[configHome]/cgrep/cgreprc"]
exclude = []
secret = []
side_effect = false
[commands]
format = 1
label = "Search source code"
description = "Context-aware grep that can limit matches to code, comments or string literals. Semantic -S patterns, file-type filters and editor launching are mostly left out."
quality = "ai-draft"
parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = false, short_bundles = false }
[[commands.source]]
id = "readme"
kind = "help"
url = "https://github.com/awgn/cgrep"
revision = "9.3.1"
evidence = """
Usage: cgrep [OPTION] [PATTERN] files...
-w,--word Force word matching
-e,--edit Use edit distance
-G,--regex Use regex matching (posix)
-i,--ignore-case Ignore case distinctions
-c,--code Enable search in source code
-m,--comment Enable search in comments
-l,--literal Enable search in string literals
-T,--tests-only Search only in test files
--no-tests Exclude test files from search
-r,--recursive Enable recursive search (don't follow symlinks)
--max-count INT Stop search in files after INT matches
-v,--invert-match Select non-matching lines
--count Print only a count of matching lines per file
--filename-only Print only the name of files containing matches
--json Format output as json object
"""
[[commands.field]]
id = "pattern"
label = "Pattern"
type = "string"
position = 0
sources = ["readme"]
[[commands.field]]
id = "files"
label = "Files or directories"
type = "path"
position = 1
multiple = true
path = { kind = "any", role = "input" }
sources = ["readme"]
[[commands.field]]
id = "recursive"
label = "Recursive"
type = "boolean"
option = ["--recursive", "-r"]
sources = ["readme"]
[[commands.field]]
id = "ignore_case"
label = "Ignore case"
type = "boolean"
option = ["--ignore-case", "-i"]
sources = ["readme"]
[[commands.field]]
id = "word"
label = "Whole word"
type = "boolean"
option = ["--word", "-w"]
sources = ["readme"]
[[commands.field]]
id = "regex"
label = "POSIX regex"
type = "boolean"
option = ["--regex", "-G"]
sources = ["readme"]
[[commands.field]]
id = "code"
label = "Search code"
type = "boolean"
option = ["--code", "-c"]
sources = ["readme"]
[[commands.field]]
id = "comment"
label = "Search comments"
type = "boolean"
option = ["--comment", "-m"]
sources = ["readme"]
[[commands.field]]
id = "literal"
label = "Search string literals"
type = "boolean"
option = ["--literal", "-l"]
sources = ["readme"]
[[commands.field]]
id = "no_tests"
label = "Exclude test files"
type = "boolean"
option = ["--no-tests"]
sources = ["readme"]
[[commands.field]]
id = "invert"
label = "Invert match"
type = "boolean"
option = ["--invert-match", "-v"]
sources = ["readme"]
[[commands.field]]
id = "max_count"
label = "Max matches per file"
type = "integer"
option = ["--max-count"]
sources = ["readme"]
[[commands.field]]
id = "count"
label = "Count only"
type = "boolean"
option = ["--count"]
sources = ["readme"]
[[commands.field]]
id = "filename_only"
label = "File names only"
type = "boolean"
option = ["--filename-only"]
sources = ["readme"]
[[commands.task]]
id = "search"
label = "Search a tree"
fields = ["pattern", "files", "recursive", "ignore_case"]
required = ["pattern"]
set = { recursive = [true] }
[[commands.task]]
id = "comments"
label = "Search comments only"
fields = ["pattern", "files", "comment", "recursive"]
required = ["pattern", "comment"]
set = { comment = [true], recursive = [true] }
[[commands.group]]
id = "basic"
label = "Basic"
fields = ["pattern", "files", "recursive", "ignore_case", "word", "regex", "code", "comment", "literal"]
[[commands.group]]
id = "advanced"
label = "Advanced"
fields = ["no_tests", "invert", "max_count", "count", "filename_only"]