id = "grep" name = "grep" description = "grep prints lines that match a pattern in files or standard input." executables = ["grep"] [commands] format = 1 label = "Search files" description = "Search for a pattern in files or directories. Context, match filtering and file selection options are included; binary-file and device handling are left out." quality = "ai-draft" base = "fig:grep" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = true } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/grep.ts" license = "MIT" [[commands.field]] id = "pattern" label = "Pattern" description = "A basic regular expression unless a pattern-type option is set." type = "string" position = 0 min = 1 sources = ["fig"] [[commands.field]] id = "paths" label = "Files or directories" description = "Leave empty to read standard input. Directories need Recursive." type = "path" position = 1 multiple = true path = { kind = "any", role = "input", must_exist = true } sources = ["fig"] [[commands.field]] id = "extended" label = "Extended regex" type = "boolean" option = ["-E"] sources = ["fig"] [[commands.field]] id = "fixed" label = "Fixed string (no regex)" type = "boolean" option = ["-F"] sources = ["fig"] [[commands.field]] id = "ignore_case" label = "Ignore case" type = "boolean" option = ["-i"] sources = ["fig"] [[commands.field]] id = "invert" label = "Invert match" type = "boolean" option = ["-v"] sources = ["fig"] [[commands.field]] id = "word" label = "Whole words only" type = "boolean" option = ["-w"] sources = ["fig"] [[commands.field]] id = "recursive" label = "Recursive" type = "boolean" option = ["-r"] sources = ["fig"] [[commands.field]] id = "line_number" label = "Show line numbers" type = "boolean" option = ["-n"] sources = ["fig"] [[commands.field]] id = "count" label = "Count matching lines" type = "boolean" option = ["-c"] sources = ["fig"] [[commands.field]] id = "files_with_matches" label = "List matching files only" type = "boolean" option = ["-l"] sources = ["fig"] [[commands.field]] id = "only_matching" label = "Print only the matched part" type = "boolean" option = ["-o"] sources = ["fig"] [[commands.field]] id = "context" label = "Context lines" type = "integer" option = ["-C"] sources = ["fig"] [[commands.field]] id = "include" label = "Only files matching glob" type = "string" option = ["--include"] sources = ["fig"] [[commands.field]] id = "exclude" label = "Skip files matching glob" type = "string" option = ["--exclude"] sources = ["fig"] [[commands.field]] id = "color" label = "Color" type = "enum" option = ["--color"] choices = [{ value = "auto", label = "Auto" }, { value = "always", label = "Always" }, { value = "never", label = "Never" }] sources = ["fig"] [[commands.task]] id = "search_tree" label = "Search a directory tree" fields = ["pattern", "paths", "recursive", "line_number"] required = ["pattern", "paths"] set = { recursive = [true], line_number = [true] } [[commands.task]] id = "list_files" label = "List files containing a match" fields = ["pattern", "paths", "recursive", "files_with_matches"] required = ["pattern", "paths"] set = { recursive = [true], files_with_matches = [true] } [[commands.group]] id = "basic" label = "Basic" fields = ["pattern", "paths", "recursive", "ignore_case", "line_number", "extended", "fixed"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["invert", "word", "count", "files_with_matches", "only_matching", "context", "include", "exclude", "color"]