if size is None:
use_pbar = False
- print("Converting: ", end='', file=sys.stderr)
- sys.stderr.flush()
+ if use_pbar:
+ print("Converting", end='', file=sys.stderr)
+ if infile.name != '<stdin>':
+ print(' ' + infile.name, end='', file=sys.stderr)
+ print(": ", end='', file=sys.stderr)
+ sys.stderr.flush()
if use_pbar:
pbar = ttyProgressBar(0, size-1)
if use_pbar:
pbar.erase()
- print("done.")
+ print("done.")
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Convert MySQL to SQL')
parser.add_argument('output_file', nargs='?', help='output file name')
args = parser.parse_args()
- if int(args.mysql) + int(args.postgres) + int(args.sqlite) > 1:
+ if int(args.mysql) + int(args.pg) + int(args.sqlite) > 1:
print("Error: options -m/-p/-s are mutually incompatible, "
"use only one of them",
file=sys.stderr)
if outfile == '-':
outfile = sys.stdout
+ args.no_pbar = True
else:
try:
outfile = open(outfile, 'wt', encoding=output_encoding)
if args.mysql:
quoting_style = 'mysql'
- elif args.postgres:
+ elif args.pg:
quoting_style = 'postgres'
else:
quoting_style = 'sqlite'