cs - Search & replace text (with some intelligence)
This documentation refers to cs version 0.1.
cs [option] search cr [option] search replace OPTIONS: Search: -A --all Find all parts on regardless of order on the line -W --words Similar to --all but with out the reordering -i --ignore-case Turn off case sensitive searching -w --whole Makes the match only whole words (ie wraps with (?<\W) & (?=\W)) -c --contains=re Only show matches if the file also matches this sub regex. This may be declared more that once and the results are ORed. -S --not-contains=re Ignore any files whoes contents match this regex. -m --smart converts multi part regexes baised on what is imput eg cs ss Class is converted to cs class Class cs n func cs function func cs b subroutine cs sub subroutine Replace: -r --replace=string String to replace found text with Files: -p --path=string A colon seperated list of directories to search in (Default current directory) -l --follow-symlinks Follow symlinks to directories --no-follow-symlinks Don't follow symlinks to directories --recurse Recurse into subdirectories (Default) --no-recurse Turns off recursing into subdirectories -n --file-include=string Only include files mathcing the regex (Multiple) -N --int=string --include-type=string Only include files the specified type (Mulitple) see perldoc File::CodeSearch::Files available types -x --file-exclude=string Don't include files mathcing the regex (Multiple) -X --ext=string --exclude-type=string Don't include files the specified type (Mulitple) see perldoc File::CodeSearch::Files available types --file-ignore=string Replace the default ignore regex -d --file-ignore-add=string Add this regex to the list of ignored files -r --file-ignore-remove=string Remove this regex to the list of ignored files Output: -s --suround=int Show int lines before and after a match -b --before=int Show int lines before a match -a --after=int Show int lines after a match -t --totals Show the total number of lines & files matched -f --files-only Show only the file names containg matches -L --last=[function|class|sub] Show the last function, class or sub name found before the matched line. Other: -E --execute=cmd Run this command with the found files as arguments -P --project=string Use the specified projects default settings -C --config=file Use the specified file as the config file instead of the deafult ~/.cs -v --verbose Show more detailed option --version Prints the version information --help Prints this help information --man Prints the full documentation for cs
A configuration file placed in ~/.csrc (or specified through --conf) allows allows the setting of default values
<default> smart = 1 </default> <project proj> exclude = /path/to/excluded/dir </project>
If you were to create a symlink to cs called proj the proj options would be selected automatically (unless you specify a project with --project).
There are no known bugs in this module.
Please report problems to Ivan Wills (ivan.wills@gmail.com).
Patches are welcome.
Ivan Wills - (ivan.wills@gmail.com)
Copyright (c) 2009 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install File::CodeSearch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::CodeSearch
CPAN shell
perl -MCPAN -e shell install File::CodeSearch
For more information on module installation, please visit the detailed CPAN module installation guide.