Add bash and markdown viewer
This commit is contained in:
parent
89dc1b4363
commit
ba1c88fcd0
2 changed files with 14 additions and 6 deletions
14
install.py
Normal file → Executable file
14
install.py
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
"""Main installer file.
|
"""Main installer file.
|
||||||
|
|
||||||
Shamelessly copied from https://github.com/dmerejkowsky/dotfiles.
|
Shamelessly copied from https://github.com/dmerejkowsky/dotfiles.
|
||||||
|
@ -14,7 +16,7 @@ import ruamel.yaml
|
||||||
|
|
||||||
|
|
||||||
class Installer:
|
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):
|
def __init__(self, force: bool = False):
|
||||||
self.conf = ruamel.yaml.safe_load( # type: ignore
|
self.conf = ruamel.yaml.safe_load( # type: ignore
|
||||||
|
@ -34,7 +36,7 @@ class Installer:
|
||||||
"""Do the git clone."""
|
"""Do the git clone."""
|
||||||
|
|
||||||
p_dest = Path(dest).expanduser()
|
p_dest = Path(dest).expanduser()
|
||||||
pretty_dest = self.pretty_path(dest)
|
pretty_dest = self.pretty_path(p_dest)
|
||||||
p_dest.parent.makedirs_p()
|
p_dest.parent.makedirs_p()
|
||||||
|
|
||||||
if p_dest.exists():
|
if p_dest.exists():
|
||||||
|
@ -52,7 +54,7 @@ class Installer:
|
||||||
"""Copy two files."""
|
"""Copy two files."""
|
||||||
|
|
||||||
p_dest = Path(dest).expanduser()
|
p_dest = Path(dest).expanduser()
|
||||||
pretty_dest = self.pretty_path(dest)
|
pretty_dest = self.pretty_path(p_dest)
|
||||||
p_dest.parent.makedirs_p()
|
p_dest.parent.makedirs_p()
|
||||||
|
|
||||||
if p_dest.exists() and not self.force:
|
if p_dest.exists() and not self.force:
|
||||||
|
@ -69,7 +71,7 @@ class Installer:
|
||||||
"""Retrieve a file from a url."""
|
"""Retrieve a file from a url."""
|
||||||
|
|
||||||
p_dest = Path(dest).expanduser()
|
p_dest = Path(dest).expanduser()
|
||||||
pretty_dest = self.pretty_path(dest)
|
pretty_dest = self.pretty_path(p_dest)
|
||||||
p_dest.parent.makedirs_p()
|
p_dest.parent.makedirs_p()
|
||||||
|
|
||||||
if p_dest.exists() and not self.force:
|
if p_dest.exists() and not self.force:
|
||||||
|
@ -84,8 +86,8 @@ class Installer:
|
||||||
def do_run(self, args: List[str]) -> None:
|
def do_run(self, args: List[str]) -> None:
|
||||||
"""Run a command."""
|
"""Run a command."""
|
||||||
|
|
||||||
ui.info_2("Running", "`{}`".format(" ".join(args)))
|
|
||||||
command = [x.format(home=self.home) for x in args]
|
command = [x.format(home=self.home) for x in args]
|
||||||
|
ui.info_2("Running", "`{}`".format(" ".join(command)))
|
||||||
subprocess.check_call(command)
|
subprocess.check_call(command)
|
||||||
|
|
||||||
def do_symlink(self, src: str, dest: str) -> None:
|
def do_symlink(self, src: str, dest: str) -> None:
|
||||||
|
@ -123,7 +125,7 @@ class Installer:
|
||||||
"""Write into a file."""
|
"""Write into a file."""
|
||||||
|
|
||||||
p_dest = Path(dest).expanduser()
|
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:
|
if p_dest.exists() and not self.force:
|
||||||
ui.info_2("Skipping", pretty_dest)
|
ui.info_2("Skipping", pretty_dest)
|
||||||
|
|
|
@ -226,6 +226,9 @@ install_scripts() { # {{{
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
markdown_mimetype() { # {{{
|
markdown_mimetype() { # {{{
|
||||||
|
######
|
||||||
|
# OK #
|
||||||
|
######
|
||||||
|
|
||||||
# Add MIME type for reading .md files in Firefox (need to add extension too)
|
# Add MIME type for reading .md files in Firefox (need to add extension too)
|
||||||
|
|
||||||
|
@ -246,6 +249,9 @@ markdown_mimetype() { # {{{
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
setup_bash_files() { # {{{
|
setup_bash_files() { # {{{
|
||||||
|
######
|
||||||
|
# OK #
|
||||||
|
######
|
||||||
|
|
||||||
# Set up .bashrc
|
# Set up .bashrc
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue