Add pipeable support.
This commit is contained in:
parent
80cdc566cb
commit
8ee6b2aca9
1 changed files with 7 additions and 2 deletions
|
@ -11,11 +11,16 @@ import argparse
|
||||||
import brename
|
import brename
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from voussoirkit import pipeable
|
||||||
|
|
||||||
def breplace_argparse(args):
|
def breplace_argparse(args):
|
||||||
|
replace_from = ' '.join(pipeable.input(args.replace_from))
|
||||||
|
replace_to = ' '.join(pipeable.input(args.replace_to))
|
||||||
|
|
||||||
if args.regex:
|
if args.regex:
|
||||||
command = f're.sub(r"{args.replace_from}", r"{args.replace_to}", x)'
|
command = f're.sub(r"{replace_from}", r"{replace_to}", x)'
|
||||||
else:
|
else:
|
||||||
command = f'x.replace("{args.replace_from}", "{args.replace_to}")'
|
command = f'x.replace("{replace_from}", "{replace_to}")'
|
||||||
brename.brename(command, autoyes=args.autoyes, recurse=args.recurse)
|
brename.brename(command, autoyes=args.autoyes, recurse=args.recurse)
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
|
Loading…
Reference in a new issue