-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added -v, --version command line option #273
Conversation
I think I can see the problem. Working on it.... |
umu/umu_run.py
Outdated
@@ -63,6 +63,9 @@ def parse_args() -> Namespace | tuple[str, list[str]]: # noqa: D103 | |||
), | |||
formatter_class=RawTextHelpFormatter, | |||
) | |||
parser.add_argument("-v", "--version", action='store_true', | |||
help="show the version and exit" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: show this version and exit
This makes it consistent with the help message.
umu/umu_run.py
Outdated
# but parse_args scans the whole command line. | ||
# So look at the first argument and see if we have -v or --version | ||
# in sort of the same way parse_args would. | ||
if sys.argv[1].lower() == "-v" or sys.argv[1].lower().startswith("--v"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would reexpress as:
if sys.argv[1].endswith(("--version", "-v")):
print(
f"umu-launcher version {__version__} ({sys.version})",
file=sys.stderr,
)
sys.exit(0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made and committed.
Many thanks.
Once you make some of those changes, I'll try to merge this ASAP. |
This adds command line options -v and --version to show the umu-run version and exit.