Skip to content
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

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

pickworthi
Copy link
Contributor

This adds command line options -v and --version to show the umu-run version and exit.

@pickworthi
Copy link
Contributor Author

I think I can see the problem. Working on it....

@pickworthi pickworthi marked this pull request as draft November 13, 2024 17:41
@pickworthi pickworthi marked this pull request as ready for review November 13, 2024 18:21
umu/umu_run.py Show resolved Hide resolved
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"
Copy link
Member

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"):
Copy link
Member

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)

Copy link
Contributor Author

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.

@R1kaB3rN
Copy link
Member

Once you make some of those changes, I'll try to merge this ASAP.

@R1kaB3rN R1kaB3rN merged commit 24fd507 into Open-Wine-Components:main Nov 13, 2024
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants