Example #1
0
File: zsh.py Project: samueljsb/qaz
    def _set_default_shell(self):
        zsh_path = shell.capture("which zsh")

        # Make sure zsh is an allowed shell.
        shells = Path("/etc/shells")
        if zsh_path not in shells.read_text():
            with shells.open("a") as fd:
                fd.write(zsh_path + "\n")

        # Make zsh the default shell.
        shell.run(f"chsh -s {zsh_path}")
Example #2
0
    def _install_vscode_extensions(self):
        command = shell.capture("command -v code")
        if not command or not self.vscode_extensions:
            return

        code.install_extensions(self.vscode_extensions)
Example #3
0
def _get_installed_casks() -> List[str]:
    return shell.capture("brew list --cask -1").split()
Example #4
0
def _get_installed_extensions() -> Set[str]:
    return set(shell.capture("code --list-extensions").split())
Example #5
0
def _get_installed_formulae() -> List[str]:
    return shell.capture("brew list --formula -1").split()
Example #6
0
def _get_installed_packages() -> List[str]:
    output = shell.capture("npm list --global --json")
    data = json.loads(output)
    return [k for k in data.get("dependencies", {})]
Example #7
0
def _get_installed_packages() -> List[str]:
    output = shell.capture("pipx list")
    return re.findall(r"package ([A-Za-z0-9_-]+)", output)
Example #8
0
def _get_installed_versions(plugin: str) -> List[str]:
    return shell.capture(f"asdf list {plugin}").split()
Example #9
0
def _get_installed_plugins() -> List[str]:
    asdf_list = shell.capture("asdf list").split("\n")
    return [name for name in asdf_list if not name.startswith(" ")]