Added --all flag to sys.args

This commit is contained in:
Patrick Nicholls 2017-04-24 21:48:53 +12:00
parent 6f0c36b67a
commit 691a3d6955

4
Other_Tools/Kobo/obok.py Normal file → Executable file
View File

@ -706,6 +706,7 @@ def cli_main():
epilog = u"Parsing of arguments failed."
parser = argparse.ArgumentParser(prog=sys.argv[0], description=description, epilog=epilog)
parser.add_argument('--devicedir', default='/media/KOBOeReader', help="directory of connected Kobo device")
parser.add_argument('--all', action='store_true', help="flag for converting all books on device")
args = vars(parser.parse_args())
serials = []
devicedir = u""
@ -714,6 +715,9 @@ def cli_main():
lib = KoboLibrary(serials, devicedir)
if args['all']:
books = lib.books
else:
for i, book in enumerate(lib.books):
print u"{0}: {1}".format(i + 1, book.title)
print u"Or 'all'"