MyNixOS website logo
Description

Command line tool.

Cgrep: a context-aware grep for source codes

CGrep: a context-aware grep for source codes

Hackage Join the chat at https://gitter.im/awgn/cgrep

Usage

Cgrep 8.0.0. Usage: cgrep [OPTION] [PATTERN] files...

cgrep [OPTIONS] [ITEM]

Pattern:
  -f --file=FILE          Read PATTERNs from file (one per line)
  -w --word               Force word matching
  -p --prefix             Force prefix matching
  -s --suffix             Force suffix matching
  -e --edit               Use edit distance
  -G --regex              Use regex matching (posix)
  -P --pcre               Use regex matching (pcre)
  -i --ignore-case        Ignore case distinctions

Context filters:
  -c --code               Enable search in source code
  -m --comment            Enable search in comments
  -l --literal            Enable search in string literals

Token filters:
     --name --identifier  Identifiers
     --type --native      Native Types
     --keyword            Keywords
     --number             Literal numbers
     --string             Literal strings
     --op                 Operators

Semantic:
  -S --semantic           "code" pattern: _, _1, _2... (identifiers), $, $1,
                          $2... (optionals), ANY, KEY, STR, LIT, NUM, HEX, OCT,
                          OR

Output control:
     --max-count=INT      Stop search in files after INT matches
  -t --type-filter=ITEM   Specify file types. ie: Cpp, +Haskell, -Makefile
  -k --kind-filter=ITEM   Specify file kinds. Text, Config, Language, Data,
                          Markup or Script
     --force-type=ITEM    Force the type of file
     --type-list          List the supported file types
  -v --invert-match       Select non-matching lines
     --multiline=INT      Enable multi-line matching
  -r --recursive          Enable recursive search (don't follow symlinks)
  -T --skip-test          Skip files that have 'test' in the name
     --prune-dir=ITEM     Do not descend into dir
  -L --follow             Follow symlinks

Output format:
     --show-match         Show list of matching tokens
     --color              Use colors to highlight the match strings
     --no-color           Do not use colors (override config file)
  -h --no-filename        Suppress the file name prefix on output
     --no-numbers         Suppress both line and column numbers on output
     --no-column          Suppress the column number on output
     --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
     --vim                Run vim editor passing the files that match
     --editor             Run the editor specified by EDITOR var., passing
                          the files that match
     --fileline           When edit option is specified, pass the list of
                          matching files in file:line format (e.g. vim
                          'file-line' plugin)

Concurrency:
  -j --threads=INT        Number threads to run in parallel

Miscellaneous:
     --verbose=INT        Verbose level: 1, 2 or 3
     --no-shallow         Disable shallow-search
     --palette            Show color palette
  -? --help               Display help message
  -V --version            Print version information
     --numeric-version    Print just the version number
Metadata

Version

8.1.0

Executables (1)

  • bin/cgrep

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows