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}")
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)
def _get_installed_casks() -> List[str]: return shell.capture("brew list --cask -1").split()
def _get_installed_extensions() -> Set[str]: return set(shell.capture("code --list-extensions").split())
def _get_installed_formulae() -> List[str]: return shell.capture("brew list --formula -1").split()
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", {})]
def _get_installed_packages() -> List[str]: output = shell.capture("pipx list") return re.findall(r"package ([A-Za-z0-9_-]+)", output)
def _get_installed_versions(plugin: str) -> List[str]: return shell.capture(f"asdf list {plugin}").split()
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(" ")]