feat: add --pythonpath to viv manage show

This commit is contained in:
Daylin Morgan 2023-05-26 20:04:13 -05:00
parent c5d9d8cb65
commit 0b26c8cb48
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -51,7 +51,7 @@ from typing import (
Type, Type,
) )
__version__ = "23.5a1" __version__ = "23.5a1-dev"
@dataclass @dataclass
@ -1027,8 +1027,14 @@ class Viv:
"""manage viv itself""" """manage viv itself"""
if args.cmd == "show": if args.cmd == "show":
if args.pythonpath:
if not self.local:
error("expected to find a local installation", exit=1)
else:
sys.stdout.write(str(self.local_source.parent) + "\n")
else:
echo("Current:") echo("Current:")
sys.stdout.write( sys.stderr.write(
SHOW_TEMPLATE.format( SHOW_TEMPLATE.format(
version=__version__, version=__version__,
cli=shutil.which("viv"), cli=shutil.which("viv"),
@ -1256,10 +1262,16 @@ class Viv:
parents=[p_manage_shared], parents=[p_manage_shared],
).set_defaults(func=self.manage, cmd="update") ).set_defaults(func=self.manage, cmd="update")
p_manage_sub.add_parser( (
p_manage_show := p_manage_sub.add_parser(
"show", help="show current installation info", aliases="s" "show", help="show current installation info", aliases="s"
)
).set_defaults(func=self.manage, cmd="show") ).set_defaults(func=self.manage, cmd="show")
p_manage_show.add_argument(
"-p", "--pythonpath", help="show the path/to/install", action="store_true"
)
args = parser.parse_args() args = parser.parse_args()
args.func(args) args.func(args)