mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-11-12 12:13:15 -06:00
feat: add --pythonpath to viv manage show
This commit is contained in:
parent
c5d9d8cb65
commit
0b26c8cb48
1 changed files with 23 additions and 11 deletions
|
@ -51,7 +51,7 @@ from typing import (
|
||||||
Type,
|
Type,
|
||||||
)
|
)
|
||||||
|
|
||||||
__version__ = "23.5a1"
|
__version__ = "23.5a1-dev"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -1027,15 +1027,21 @@ class Viv:
|
||||||
"""manage viv itself"""
|
"""manage viv itself"""
|
||||||
|
|
||||||
if args.cmd == "show":
|
if args.cmd == "show":
|
||||||
echo("Current:")
|
if args.pythonpath:
|
||||||
sys.stdout.write(
|
if not self.local:
|
||||||
SHOW_TEMPLATE.format(
|
error("expected to find a local installation", exit=1)
|
||||||
version=__version__,
|
else:
|
||||||
cli=shutil.which("viv"),
|
sys.stdout.write(str(self.local_source.parent) + "\n")
|
||||||
running_src=self.running_source,
|
else:
|
||||||
local_src=self.local_source,
|
echo("Current:")
|
||||||
|
sys.stderr.write(
|
||||||
|
SHOW_TEMPLATE.format(
|
||||||
|
version=__version__,
|
||||||
|
cli=shutil.which("viv"),
|
||||||
|
running_src=self.running_source,
|
||||||
|
local_src=self.local_source,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
elif args.cmd == "update":
|
elif args.cmd == "update":
|
||||||
if self.local_source == "Not Found":
|
if self.local_source == "Not Found":
|
||||||
|
@ -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(
|
(
|
||||||
"show", help="show current installation info", aliases="s"
|
p_manage_show := p_manage_sub.add_parser(
|
||||||
|
"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)
|
||||||
|
|
Loading…
Reference in a new issue