Add bash and markdown viewer

This commit is contained in:
flyingscorpio@arch-desktop 2020-04-18 23:57:35 +02:00
parent 89dc1b4363
commit ba1c88fcd0
2 changed files with 14 additions and 6 deletions

14
install.py Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/python3
"""Main installer file.
Shamelessly copied from https://github.com/dmerejkowsky/dotfiles.
@ -14,7 +16,7 @@ import ruamel.yaml
class Installer:
"""Regroups all the installation methods listed in the yml conf file."""
"""Regroups all the installation methods listed in the yaml conf file."""
def __init__(self, force: bool = False):
self.conf = ruamel.yaml.safe_load( # type: ignore
@ -34,7 +36,7 @@ class Installer:
"""Do the git clone."""
p_dest = Path(dest).expanduser()
pretty_dest = self.pretty_path(dest)
pretty_dest = self.pretty_path(p_dest)
p_dest.parent.makedirs_p()
if p_dest.exists():
@ -52,7 +54,7 @@ class Installer:
"""Copy two files."""
p_dest = Path(dest).expanduser()
pretty_dest = self.pretty_path(dest)
pretty_dest = self.pretty_path(p_dest)
p_dest.parent.makedirs_p()
if p_dest.exists() and not self.force:
@ -69,7 +71,7 @@ class Installer:
"""Retrieve a file from a url."""
p_dest = Path(dest).expanduser()
pretty_dest = self.pretty_path(dest)
pretty_dest = self.pretty_path(p_dest)
p_dest.parent.makedirs_p()
if p_dest.exists() and not self.force:
@ -84,8 +86,8 @@ class Installer:
def do_run(self, args: List[str]) -> None:
"""Run a command."""
ui.info_2("Running", "`{}`".format(" ".join(args)))
command = [x.format(home=self.home) for x in args]
ui.info_2("Running", "`{}`".format(" ".join(command)))
subprocess.check_call(command)
def do_symlink(self, src: str, dest: str) -> None:
@ -123,7 +125,7 @@ class Installer:
"""Write into a file."""
p_dest = Path(dest).expanduser()
pretty_dest = self.pretty_path(dest)
pretty_dest = self.pretty_path(p_dest)
if p_dest.exists() and not self.force:
ui.info_2("Skipping", pretty_dest)

View file

@ -226,6 +226,9 @@ install_scripts() { # {{{
} # }}}
markdown_mimetype() { # {{{
######
# OK #
######
# Add MIME type for reading .md files in Firefox (need to add extension too)
@ -246,6 +249,9 @@ markdown_mimetype() { # {{{
} # }}}
setup_bash_files() { # {{{
######
# OK #
######
# Set up .bashrc