[Python-Dev] Slash and burn in Tools/scripts. Objections?
Barry A. Warsaw
barry@zope.com
Thu, 14 Mar 2002 00:19:02 -0500
>>>>> "TP" == Tim Peters <tim.one@comcast.net> writes:
TP> "Innovations" I really like:
TP> + An -r switch to control whether directory recursion occurs.
TP> Sometimes you simply don't want to touch subdirectories at all
TP> (e.g., I don't dare reindent the Lib/irix5 subtree, cuz I've
TP> got no way to test it).
TP> + A -d switch for a "dry run", just naming the files that
TP> *would* change.
And /please/ have long-option alternatives for each of the short
opts. E.g. --dry-run. It is okay for there to only be a long-opt
version of a switch. Also, always have -h/--help and (probably)
-V/--version. Try to find a similar existing too and match its
options where appropriate (e.g. patch(1) has the essential --dry-run
and -b/--backup). I don't know if there are standards for this kind
of thing, so make consistency a goal, but don't freak out if it's an
impossible goal to meet <wink>
TP> See, e.g., Guido's old classfix.py for a different approach.
TP> That also renames, but renames with a tilde turd at the end
TP> (jarring on Windows; perhaps .bak is jarring on Unix); may or
TP> may not (I can't remember how Unix works here) give up if the
TP> tilde form already exists; and (most important) strives to
TP> reproduce the original file's permissions.
Please, no tilde files. AFAIK, that's an Emacs-ism that some other
editors have adopted, but few command line oriented programs have.
One of the beautiful things about using vc-mode or cvs-mode under
(X)Emacs is the total lack of dumb ~ files that need cleaning up
('cause they're all backed up under RCS or CVS anyway, so why make ~
backups?).
TP> I got out of that habit after years of Windows, and got lazy
TP> about hunting the code down to paste in to new tools.
TP> Curiously, nobody ever griped! Maybe it was actually a YDNI
TP> (You Didn't Need It)?
Oh jeez, acronym explosion time. Some How, I Think Not Obvious.
-Barry