Skip to content

Commandline support

Davide Ficano edited this page May 6, 2013 · 5 revisions

Overview

VisualGrep includes a command line tool, visgrep, to start searches from the command line. This can be used to launch the user interface and run searches.

Setup

The first task is to make a symlink to visgrep. Assuming you've placed VisualGrep in the Applications folder, and that you have a ~/bin directory in your path, you can run:

ln -s "/Applications/VisualGrep.app/Contents/Resources/visgrep" ~/bin/visgrep

Usage

Run visgrep --help

visgrep: Launch the VisualGrep user interface
usage: visgrep [-hvw] [-t template_name] [path] pattern
At least specify the string pattern to search.
If search path isn't specified then use the current directory.
-t, --template=TEMPLATE_NAME  Start the search using the selected template
-w, --wait                    Wait until user closes the VisualGrep document
                              or the application before returning to shell
-h, --help                    Show this help
-v, --version                 Show version
Example
visgrep foo                   Search the pattern 'foo'
                              into current directory and any subfolders
visgrep /Users foo            Search the pattern 'foo'
                              into the directory '/Users' and any subfolders
visgrep -t html               Search using the template 'html'
                              the template must contain search path
                              and pattern otherwise the search doesn't start
visgrep -t html foo           Search using the template 'html'
                              and override (if any) the pattern with 'foo'
visgrep -t html /Users foo    Search using the template 'html'
                              and override (if any) the pattern with 'foo'
                              and the search path with '/Users'

Clone this wiki locally