Options (6)
-p, --patternbooleanSearch for a pattern in files
Example:
ast-grep run {{[-p|--pattern]}} '{{pattern}}' {{path/to/file}}-l, --langbooleanSearch for a pattern in a specific language
Example:
ast-grep run {{[-p|--pattern]}} '{{pattern}}' {{[-l|--lang]}} {{python}} {{path/to/directory}}-r, --rewritebooleanRewrite code matching a pattern
Example:
ast-grep run {{[-p|--pattern]}} '{{pattern}}' {{[-r|--rewrite]}} '{{replacement}}' {{path/to/file}}-r, --rulebooleanRun rules from a configuration file
Example:
ast-grep scan {{[-r|--rule]}} {{path/to/rule.yml}} {{path/to/directory}}-i, --interactivebooleanInteractively search and rewrite code
Example:
ast-grep run {{[-p|--pattern]}} '{{pattern}}' {{[-i|--interactive]}} {{path/to/directory}}-h, --helpbooleanDisplay help for a subcommand
Example:
ast-grep {{run}} {{[-h|--help]}}Examples (6)
Search for a pattern in files
ast-grep run [-p|--pattern] 'pattern' path/to/fileSearch for a pattern in a specific language
Rewrite code matching a pattern
ast-grep run [-p|--pattern] 'pattern' [-r|--rewrite] 'replacement' path/to/fileRun rules from a configuration file
ast-grep scan [-r|--rule] path/to/rule.yml path/to/directoryInteractively search and rewrite code
ast-grep run [-p|--pattern] 'pattern' [-i|--interactive] path/to/directoryDisplay help for a subcommand
ast-grep run [-h|--help]made by @shridhargupta | data from tldr-pages