From e4a0eb68afb85eddb0761609cc5995a254a24441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Faur=C3=A9?= Date: Wed, 10 May 2023 11:03:13 +0200 Subject: [PATCH] better cli --- spip2md/spip2md.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spip2md/spip2md.py b/spip2md/spip2md.py index f2f18b3..9e3fb92 100755 --- a/spip2md/spip2md.py +++ b/spip2md/spip2md.py @@ -22,7 +22,7 @@ articles = SpipArticles.select().order_by(SpipArticles.date.desc()) # Choose how many articles to export based on first param if len(sys.argv) > 1: - if int(sys.argv[1]) > 0: + if int(sys.argv[1]) > 0 and int(sys.argv[1]) < len(articles): nbToExport = int(sys.argv[1]) else: nbToExport = len(articles) @@ -64,4 +64,6 @@ for exported in range(nbToExport): db.close() # Announce the end of the script -print(f"\n--- Exported {nbToExport} SPIP articles to ./{CONFIG['outputDir']}/*/index.md ---") +print( + f"\n--- Exported {nbToExport} SPIP articles to ./{CONFIG['outputDir']}/*/index.md ---" +)