Restructured code slightly
All checks were successful
ydeng/renamebycsv/pipeline/head This commit looks good

This commit is contained in:
Harrison Deng 2023-04-21 11:27:27 -05:00
parent 7bb56ac14d
commit a566813c56

View File

@ -70,6 +70,13 @@ def rename(
logging.info("No file names were modified.") logging.info("No file names were modified.")
def run(args):
candidates = find_all_candidates(args.input_dir, args.regex, args.recursive)
rename(
args.csv, candidates, args.current, args.become, args.dry, args.keep_extension
)
def main(): def main():
program_name = "renamebycsv" program_name = "renamebycsv"
argparser = argparse.ArgumentParser( argparser = argparse.ArgumentParser(
@ -135,10 +142,7 @@ def main():
format="[%(filename)s %(asctime)s - %(levelname)s] %(message)s", format="[%(filename)s %(asctime)s - %(levelname)s] %(message)s",
level=args.verbosity.upper(), level=args.verbosity.upper(),
) )
candidates = find_all_candidates(args.input_dir, args.regex, args.recursive) run(args)
rename(
args.csv, candidates, args.current, args.become, args.dry, args.keep_extension
)
if __name__ == "__main__": if __name__ == "__main__":