From ffbffd02c577823987d86b26ca4f78330403e01c Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Sun, 26 Apr 2020 16:07:48 +0200 Subject: [PATCH] [exp] Improve usage message and exit --- examples/load_credentials_file.py | 9 ++------- examples/load_scuttlebutt_file.py | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/examples/load_credentials_file.py b/examples/load_credentials_file.py index a3de26d6..48212c64 100644 --- a/examples/load_credentials_file.py +++ b/examples/load_credentials_file.py @@ -3,14 +3,9 @@ import sys from duniterpy.key import SigningKey if __name__ == "__main__": - if len(sys.argv) < 2: - print( - """ - Usage: - python load_credentials_file.py FILEPATH - """ - ) + print("Usage: python load_credentials_file.py FILEPATH") + sys.exit(1) # capture filepath argument credentials_filepath = sys.argv[1] diff --git a/examples/load_scuttlebutt_file.py b/examples/load_scuttlebutt_file.py index 675b205c..cd6d192c 100644 --- a/examples/load_scuttlebutt_file.py +++ b/examples/load_scuttlebutt_file.py @@ -3,14 +3,9 @@ import sys from duniterpy.key import SigningKey if __name__ == "__main__": - if len(sys.argv) < 2: - print( - """ - Usage: - python load_scuttlebutt_file.py FILEPATH - """ - ) + print("Usage: python load_scuttlebutt_file.py FILEPATH") + sys.exit(1) # capture filepath argument scuttlebutt_filepath = sys.argv[1] -- GitLab