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

CLI: display detailed version info with --version #1134

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/rez/cli/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from rez.cli._util import subcommands, LazyArgumentParser, _env_var_true
from rez.utils.logging_ import print_error
from rez.exceptions import RezError, RezSystemError, _NeverError
from rez import __version__
from rez import __version__, module_root_path


# true if command was like 'rez-env' rather than 'rez env'
Expand Down Expand Up @@ -84,12 +84,15 @@ def setup_parser():
Returns:
LazyArgumentParser: Argument parser for rez command.
"""
py = sys.version_info
parser = LazyArgumentParser("rez")

parser.add_argument("-i", "--info", action=InfoAction,
help="print information about rez and exit")
parser.add_argument("-V", "--version", action="version",
version="Rez %s" % __version__)
version="Rez %s from %s (python %d.%d)" % (
__version__, module_root_path, py.major, py.minor
))

# add args common to all subcommands... we add them both to the top parser,
# AND to the subparsers, for two reasons:
Expand Down