From 50a617dd78ed0df37d13c884729cf44e316dd52f Mon Sep 17 00:00:00 2001 From: Hans Fangohr <hans.fangohr@mpsd.mpg.de> Date: Mon, 12 Jun 2023 16:54:29 +0200 Subject: [PATCH] Catch potential user error - if passed to 'available', this creates a long and not very helpful message that lists all branches. - if we catch it here, we avoid that. --- mpsd-software.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mpsd-software.py b/mpsd-software.py index e32351a..f7eec65 100755 --- a/mpsd-software.py +++ b/mpsd-software.py @@ -1113,6 +1113,14 @@ def main(): get_installer_log_file_path(args.release, args.action, root_dir), ) + # sanity check for common mistakes in command line arguments + if args.release.endswith("/"): # happens easily with autocompletion + logging.error( + f"You provided mpsd-release='{args.release}'. " + "Did you mean '{args.release.rstrip('/')}'?" + ) + sys.exit(1) + # Check the command and run related function if args.action == "remove": remove_environment(args.release, args.toolchains, root_dir) -- GitLab