Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eugenesvk/xontrib-homebrew
Add Homebrew's shell environment to xonsh shell on macOS/Linux
https://github.com/eugenesvk/xontrib-homebrew
brew homebrew linux linuxbrew macos xonsh xontrib
Last synced: about 2 months ago
JSON representation
Add Homebrew's shell environment to xonsh shell on macOS/Linux
- Host: GitHub
- URL: https://github.com/eugenesvk/xontrib-homebrew
- Owner: eugenesvk
- License: mit
- Created: 2021-07-24T17:58:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-28T11:11:24.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T22:16:26.323Z (2 months ago)
- Topics: brew, homebrew, linux, linuxbrew, macos, xonsh, xontrib
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: License
Awesome Lists containing this project
- awesome-xontribs - homebrew - Add Homebrew's shell environment to xonsh shell on macOS/Linux. (Integrations / Prompt tweaks)
README
Add Homebrew's shell environment to xonsh shell on macOS/Linux
(alternative to shellenv).
If you like the idea click ⭐ on the repo and tweet. This might also accelerate adding xonsh support to Homebrew.## Introduction
__Homebrew__ has a `shellenv` command to add __its environment__ to your shell: it adds a few
environment variables (`HOMEBREW_` `PREFIX`/`CELLAR`/`REPOSITORY`) and updates a few paths (`MAN`/`INFO`/ `PATH`).This xontrib automatically translates the default __bash__ export statements of `shellenv` into __xonsh__.
## Installation
To install use pip:
```bash
xpip install xontrib-homebrew
# or: xpip install -U git+https://github.com/eugenesvk/xontrib-homebrew
```This xontrib will get loaded automatically for interactive sessions; to stop this, set
```xonsh
$XONTRIBS_AUTOLOAD_DISABLED = {"homebrew", }
```## Usage
Add this to your xonsh run control file (`~/.xonshrc` or `~/.config/rc.xsh`):
```bash
xontrib load homebrew
```Set custom Homebrew installation path via `$XONTRIB_HOMEBREW_PATHBREW` to `/full/path/to/bin/brew` if it's not installed at these default paths (which always take precedence):
| macOS | Linux |
|:------------------------ |:------------------------------------- |
| `/usr/local/bin/brew` | `/home/linuxbrew/.linuxbrew/bin/brew` |
| `/opt/homebrew/bin/brew` | `~/.linuxbrew/bin/brew` |Set the level of verbosity via `$XONTRIB_HOMEBREW_LOGLEVEL` to __0–3__ (default __1__):
- 0 print nothing (fail silently)
- __1__ print errors (e.g. can't find `brew` at default locations)
- 2 print warnings (e.g issues when parsing `shellenv`)
- 3 print more verbose messages## Known issues
- Xontrib autoload currently can't be disabled due to a [xonsh bug](https://github.com/xonsh/xonsh/issues/5020), so if you need precise control over when your environment variables are set (e.g., whether `/path/to/homebrew/bin` is at the top of `PATH`), try installing from a `deauto` branch:
`xpip install -U git+https://github.com/eugenesvk/xontrib-homebrew@deauto`
- Likely due to the same bug your `$XONTRIB_HOMEBREW_PATHBREW` and `$XONTRIB_HOMEBREW_LOGLEVEL` env vars might be ignored in the autoloaded version, so install the `@deauto` version mentioned above## Credits
This package was created with [xontrib cookiecutter template](https://github.com/xonsh/xontrib-cookiecutter).