def main(): args = parseArgument() #옵션에 따라 진행 if args.cmd=='search': import search search.contains(args.input, args.output, args.term, args.regex) elif args.cmd=='delete': import delete if args.duplicatedLines: delete.duplicatedLines(args.input, args.output, args.withoutBlankLines) else: delete.contains(args.input, args.output, args.term, args.regex) elif args.cmd=='trim': from trim import trim trim(args.input, args.output, args.lines) print '' print 'Done!'
def main(): start = datetime.datetime.now() args = parseArgument() #옵션에 따라 진행 if args.cmd=='search': import search search.contains(args.input, args.output, args.term, args.regex) elif args.cmd=='delete': import delete if args.duplicatedLines: delete.duplicatedLines(args.input, args.output, args.withoutBlankLines) else: delete.contains(args.input, args.output, args.term, args.regex) elif args.cmd=='trim': from trim import trim trim(args.input, args.output, args.lines) took = datetime.datetime.now() - start log.info('Done! (%dsec.)' % (took.seconds))
#default arguments parser.add_argument('-i', '--input', help='file to process.') parser.add_argument('-o', '--output', help='file to save result.(default=stdout)') #smart_open.py #parse! args = parser.parse_args() if not args.input: parser.error("No input file provided. use '-i' or '--input'") return args if __name__ == "__main__": args = parseArgument() #옵션에 따라 진행 if args.cmd=='search': import search search.contains(args.input, args.output, args.term, args.regex) elif args.cmd=='delete': import delete if args.duplicatedLines: delete.duplicatedLines(args.input, args.output, args.withoutBlankLines) else: delete.contains(args.input, args.output, args.term, args.regex) elif args.cmd=='trim': from trim import trim trim(args.input, args.output, args.lines) print '' print 'Done!'