Commit 97cfca1e authored by Hartmut Goebel's avatar Hartmut Goebel
Browse files

Switch from optparse module to argparse.

parent 11199156
......@@ -26,23 +26,25 @@ __licence__ = "GNU General Public License version 3 (GPL v3)"
from . import main, __version__, DecryptionError
def run():
import optparse
parser = optparse.OptionParser('%prog [options] InputFile OutputFile',
parser.add_option('-v', '--verbose', action='count', default=0,
import argparse
parser = argparse.ArgumentParser('%prog [options] InputFile OutputFile',
parser.add_argument('-v', '--verbose', action='count', default=0,
help='Be verbose. Tell about number of pages rearranged. Can be used more than once to increase the verbosity. ')
parser.add_option('-n', '--dry-run', action='store_true',
parser.add_argument('-n', '--dry-run', action='store_true',
help='Show what would have been done, but do not generate files.')
group = parser.add_option_group('Define Target')
group.add_option('-s', '--signature', type=int, default=4,
group = parser.add_argument_group('Define Target')
group.add_argument('-s', '--signature', type=int, default=4,
help='Specify the size of the signature (number '
'of sides which will be folded and bound together). Default: %default')
'of sides which will be folded and bound together). Default: %(default)s')
opts, args = parser.parse_args()
if len(args) != 2:
parser.error('Requires both input and output filename.')
if opts.signature % 4 != 0 or opts.signature < 0:
parser.error('-s/--signature <signature> must be positive and divisible by 4.')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment