Resolve 2px creation, but need a better implementation of conditional run
This commit is contained in:
parent
9fdf0b5b73
commit
4acf196dcc
1 changed files with 19 additions and 3 deletions
22
install.py
22
install.py
|
@ -54,7 +54,7 @@ class Installer:
|
|||
|
||||
ui.info_2("Cloning", url, "->", pretty_dest)
|
||||
git_command = "git clone {} {} --branch {}".format(url, p_dest, branch)
|
||||
subprocess.run(git_command, check=True)
|
||||
subprocess.run(git_command, check=True, shell=True)
|
||||
|
||||
def do_copy(self, src: str, dest: str) -> None:
|
||||
"""Copy two files."""
|
||||
|
@ -133,7 +133,7 @@ class Installer:
|
|||
|
||||
src_full.symlink(p_dest)
|
||||
|
||||
def do_update(self, command: str) -> None:
|
||||
def do_run_update(self, command: str) -> None:
|
||||
"""Run a command only if self.update is True."""
|
||||
|
||||
if self.update:
|
||||
|
@ -141,9 +141,25 @@ class Installer:
|
|||
else:
|
||||
ui.info_2("Skipping", "`{}`".format(command))
|
||||
|
||||
def do_run_no_update(self, command: str) -> None:
|
||||
"""Run a command only if self.update is False."""
|
||||
|
||||
if not self.update:
|
||||
self.do_run(command)
|
||||
else:
|
||||
ui.info_2("Skipping", "`{}`".format(command))
|
||||
|
||||
def do_append(self, dest: str, content: str) -> None:
|
||||
"""Append to a file."""
|
||||
|
||||
self._do_write(dest, content, append=True)
|
||||
|
||||
def do_write(self, dest: str, content: str) -> None:
|
||||
"""Write into a file."""
|
||||
|
||||
self._do_write(dest, content, append=False)
|
||||
|
||||
def _do_write(self, dest: str, content: str, *, append: bool) -> None:
|
||||
p_dest = Path(dest).expanduser()
|
||||
pretty_dest = self.pretty_path(p_dest)
|
||||
|
||||
|
@ -158,7 +174,7 @@ class Installer:
|
|||
if not content.endswith("\n"):
|
||||
content += "\n"
|
||||
|
||||
p_dest.write_text(content)
|
||||
p_dest.write_text(content, append=append)
|
||||
|
||||
def install(self, programs: Optional[List[str]] = None) -> None:
|
||||
"""Install the programs provided.
|
||||
|
|
Loading…
Add table
Reference in a new issue