mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-09-20 12:07:18 -05:00
developdevelopdevelop
This commit is contained in:
parent
312ed47381
commit
6d98e2a755
1 changed files with 20 additions and 8 deletions
|
@ -51,7 +51,7 @@ from typing import (
|
||||||
Generator,
|
Generator,
|
||||||
)
|
)
|
||||||
|
|
||||||
__version__ = "22.12a3-51-g0939736-dev"
|
__version__ = "22.12a3-52-g312ed47-dev"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -807,7 +807,7 @@ class ArgumentParser(StdArgParser):
|
||||||
description = f"""
|
description = f"""
|
||||||
|
|
||||||
{a.tagline()}
|
{a.tagline()}
|
||||||
{a.style('to create/activate a vivenv','underline')}:
|
to create/activate a vivenv:
|
||||||
- from command line: `{a.style("viv -h","bold")}`
|
- from command line: `{a.style("viv -h","bold")}`
|
||||||
- within python script: {a.style('__import__("viv").use("typer", "rich-click")','bold')}
|
- within python script: {a.style('__import__("viv").use("typer", "rich-click")','bold')}
|
||||||
"""
|
"""
|
||||||
|
@ -863,6 +863,10 @@ class Viv:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
self.local_source = "Not Found"
|
self.local_source = "Not Found"
|
||||||
|
|
||||||
|
self.git = self.local_source != "Not Found" and str(self.local_source).endswith(
|
||||||
|
"src/viv/__init__.py"
|
||||||
|
)
|
||||||
|
|
||||||
def _match_vivenv(self, name_id: str) -> ViVenv: # type: ignore[return]
|
def _match_vivenv(self, name_id: str) -> ViVenv: # type: ignore[return]
|
||||||
# TODO: improve matching algorithm to favor names over id's
|
# TODO: improve matching algorithm to favor names over id's
|
||||||
matches: List[ViVenv] = []
|
matches: List[ViVenv] = []
|
||||||
|
@ -970,7 +974,10 @@ class Viv:
|
||||||
vivenv.dump_info()
|
vivenv.dump_info()
|
||||||
|
|
||||||
def manage(self, args: Namespace) -> None:
|
def manage(self, args: Namespace) -> None:
|
||||||
"""manage viv installation"""
|
"""manage viv itself
|
||||||
|
|
||||||
|
Can be used to install or update an existing viv installation
|
||||||
|
"""
|
||||||
if args.cmd == "show":
|
if args.cmd == "show":
|
||||||
echo("Current:")
|
echo("Current:")
|
||||||
sys.stdout.write(
|
sys.stdout.write(
|
||||||
|
@ -990,6 +997,12 @@ class Viv:
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self.git:
|
||||||
|
error(
|
||||||
|
a.style("viv manage update", "bold")
|
||||||
|
+ " shouldn't be used with a git-based installation",
|
||||||
|
1,
|
||||||
|
)
|
||||||
sha256 = fetch_source(args.reference)
|
sha256 = fetch_source(args.reference)
|
||||||
sys.path.append(str(c.srccache))
|
sys.path.append(str(c.srccache))
|
||||||
next_version = __import__(sha256).__version__
|
next_version = __import__(sha256).__version__
|
||||||
|
@ -1004,7 +1017,7 @@ class Viv:
|
||||||
print("Holding off on the additions of this piece")
|
print("Holding off on the additions of this piece")
|
||||||
|
|
||||||
elif args.cmd == "install":
|
elif args.cmd == "install":
|
||||||
if self.local_source:
|
if not self.local_source == "NotFound":
|
||||||
error(f"found existing viv installation at {self.local_source}")
|
error(f"found existing viv installation at {self.local_source}")
|
||||||
echo(
|
echo(
|
||||||
"use "
|
"use "
|
||||||
|
@ -1022,7 +1035,7 @@ class Viv:
|
||||||
# TODO: src path and cli path should be shard args between update/install
|
# TODO: src path and cli path should be shard args between update/install
|
||||||
|
|
||||||
q = INSTALL_TEMPLATE.format(
|
q = INSTALL_TEMPLATE.format(
|
||||||
src_location="~/.local/share/viv/viv.py", cli_location="~/bin/viv"
|
src_location=args.src, cli_location=args.cli
|
||||||
) + ("Would you like to perform the above " "installation steps?")
|
) + ("Would you like to perform the above " "installation steps?")
|
||||||
|
|
||||||
if confirm(q):
|
if confirm(q):
|
||||||
|
@ -1152,8 +1165,7 @@ class Viv:
|
||||||
p_manage_shared.add_argument(
|
p_manage_shared.add_argument(
|
||||||
"-s",
|
"-s",
|
||||||
"--src",
|
"--src",
|
||||||
help="path/to/source file",
|
help="path/to/source_file",
|
||||||
# default =
|
|
||||||
default=c.srccache / "viv.py",
|
default=c.srccache / "viv.py",
|
||||||
)
|
)
|
||||||
p_manage_shared.add_argument(
|
p_manage_shared.add_argument(
|
||||||
|
|
Loading…
Reference in a new issue