mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 18:03:31 +01:00
process-text-files.py: Slightly beautify help message
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
70117f9d34
commit
0cb09081eb
1 changed files with 6 additions and 6 deletions
|
|
@ -144,9 +144,9 @@ class Cmd(jwutils.Cmd):
|
|||
|
||||
def add_parser(self, parsers):
|
||||
p = super(Cmd, self).add_parser(parsers)
|
||||
p.add_argument("--regex", help="Specify regular expression by input file", default=None)
|
||||
p.add_argument("--replace-patterns-from", help="File with patterns to replace, side by side, divided by '->'", default=None)
|
||||
p.add_argument('-r', "--root", help="Point in file system from which to start search", default='.')
|
||||
p.add_argument("--name-regex", help="Regular expression to select input file names", default=None)
|
||||
p.add_argument("--replace-patterns-from", help="File with patterns to replace, side by side, divided by '->'", default=None)
|
||||
p.add_argument("--backup", help="Backup extension", default='rep')
|
||||
p.add_argument('-g', '--git', help="Use git mv for renaming files", action='store_true', default=False)
|
||||
return p
|
||||
|
|
@ -165,10 +165,10 @@ class Cmd(jwutils.Cmd):
|
|||
self._init(args)
|
||||
slog(NOTICE, "running")
|
||||
files = []
|
||||
if args.regex is not None:
|
||||
if args.name_regex is not None:
|
||||
for root, dirs, names in os.walk(args.root):
|
||||
for name in names:
|
||||
if re.match(args.regex, name):
|
||||
if re.match(args.name_regex, name):
|
||||
files.append((root, name))
|
||||
self.process(args, files)
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ class CmdReplaceCppSymbols(Cmd):
|
|||
|
||||
# overriding
|
||||
def run(self, args):
|
||||
if args.regex is not None:
|
||||
if args.name_regex is not None:
|
||||
return super(CmdReplaceCppSymbols, self).run(args)
|
||||
self._init(args)
|
||||
slog(NOTICE, "running")
|
||||
|
|
@ -260,7 +260,7 @@ class CmdAddCppNamespace(Cmd):
|
|||
|
||||
# overriding
|
||||
def run(self, args):
|
||||
if args.regex is not None:
|
||||
if args.name_regex is not None:
|
||||
return super(CmdAddCppNamespace, self).run(args)
|
||||
self._init(args)
|
||||
slog(NOTICE, "running")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue