| 1 |
|
|---|
| 2 |
Script for mechanical code changes |
|---|
| 3 |
================================== |
|---|
| 4 |
|
|---|
| 5 |
NOTE: |
|---|
| 6 |
This script requires python 2.4 as it makes use of syntax introduced in |
|---|
| 7 |
that version. |
|---|
| 8 |
|
|---|
| 9 |
Run the file Main.py without arguments to get a list of the available command |
|---|
| 10 |
line options. In general call Main.py with the desired options followed by a |
|---|
| 11 |
list of files or directories. For directories all files in the mentioned dir and |
|---|
| 12 |
in any subdirectory will be processed, for files on the command line only the |
|---|
| 13 |
mentioned file will be processed. |
|---|
| 14 |
|
|---|
| 15 |
Currently known options: |
|---|
| 16 |
|
|---|
| 17 |
-h, --help show the help message and exit. |
|---|
| 18 |
-d DIFFFILE, --diff=DIFFFILE |
|---|
| 19 |
write a unified diff to DIFFFILE. This can later be |
|---|
| 20 |
applied with the patch tool. If this options is present |
|---|
| 21 |
the diff will be written independent of the -n option. |
|---|
| 22 |
[default: write no diff]. |
|---|
| 23 |
-f, --followsymlink follow symbolic links to directories. |
|---|
| 24 |
[default: do not follow symlinks]. |
|---|
| 25 |
-l LOGFILE, --logfile=LOGFILE |
|---|
| 26 |
write a log to LOGFILE. [default: write no log]. |
|---|
| 27 |
-n, --noop do not modify files on disk. |
|---|
| 28 |
[default: modify files on disk]. |
|---|
| 29 |
-o "OP1:OP2:...", --operations="OP1:OP2:..." |
|---|
| 30 |
only perform the listed operations "OP1:OP2:...". |
|---|
| 31 |
See the -s option for a list of recognized names. |
|---|
| 32 |
[default: all]. |
|---|
| 33 |
-p REGEX, --pattern=REGEX |
|---|
| 34 |
only operate on files matching the REGEX. Only the name |
|---|
| 35 |
of the file, not including its path is tested against |
|---|
| 36 |
the reg ex. |
|---|
| 37 |
[default: operate on all files]. |
|---|
| 38 |
-s, --show-ops display a list of operation names for use with the -o |
|---|
| 39 |
option and exit. |
|---|
| 40 |
-v, --verbose print verbose log, can be used multiple times to |
|---|
| 41 |
increase verbosity. |
|---|
| 42 |
|
|---|
| 43 |
To add more operations have a look at the file StandardOperation.py, where |
|---|
| 44 |
the already known operations are instantiated. If an operation requires more |
|---|
| 45 |
sophisticated changes than a simple replace, have a look at Operations.py and |
|---|
| 46 |
ConversionDriver.py to see how these interact. |
|---|