Skip to content

Add more candidate directories to be added to $PATH #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/megalinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ jobs:
# Run Linter against code base #
################################
- name: Lint Code Base
uses: nvuillam/mega-linter@v4
uses: nvuillam/mega-linter@v5
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISABLE_LINTERS: SPELL_CSPELL
# SPELL_MISSPELL_FILTER_REGEX_EXCLUDE: '(\.yml)'

# Upload Mega-Linter artifacts. They will be available on Github action page "Artifacts" section
- name: Archive production artifacts
Expand Down
12 changes: 11 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,14 @@

## 1.3.2

- Swiftbar started capturing `stderr` in addition to `stdout`, causing log messages to spam the menu bar. Default to log level critical so we don't spam log messages (that no one was seeing anyway) except when we're testing.
- Swiftbar started capturing `stderr` in addition to `stdout`, causing log messages to spam the menu bar. Default to log level critical so we don't spam log messages (that no one was seeing anyway) except when we're testing.

## 1.3.3

dd more candidate directories to be added to $PATH

- Check for `~/homebrew/bin` and `~/homebrew/sbin` to cope when homebrew
is installed in a user's home directory. Closes https://github.com/unixorn/lima-xbar-plugin/issues/28
- While we're in there, check for `/usr/local/sbin`,
`/opt/homebrew/sbin`, `/opt/local/sbin`, `~/bin` and `~/sbin`
directories too.
19 changes: 15 additions & 4 deletions lima-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUNNING_VM_COLOR = "#29cc00"
# Stopped VM color (default red)
STOPPED_VM_COLOR = "#ff0033"

VERSION = "1.3.2"
VERSION = "1.3.3"


def logSetup(level: str = "INFO"):
Expand Down Expand Up @@ -270,15 +270,26 @@ def prep_environment_for_lima(vm: str = "default", env: dict = dict(os.environ))
"""
Set up an environment dictionary we can use to run a lima command.

Also adds /usr/local/bin, /opt/homebrew/bin and /opt/local/bin to $PATH
if they exist and are directories.
Also adds /usr/local/{s}bin, /opt/homebrew/{s}bin, /opt/local/{s}bin,
~/homebrew/{s}bin and ~/{s}bin to $PATH if they exist and are directories.

:param str vm: VM to work in
:param dict env: Environment variables to base returned environment on

:return dict: Environment dictionary, with extra bindirs added to $PATH
"""
extrapaths = ["/usr/local/bin", "/opt/homebrew/bin", "/opt/local/bin"]
extrapaths = [
"/opt/homebrew/bin",
"/opt/homebrew/sbin",
"/opt/local/bin",
"/opt/local/sbin",
"/usr/local/bin",
"/usr/local/sbin",
f"{os.environ.get('HOME')}/bin",
f"{os.environ.get('HOME')}/homebrew/bin",
f"{os.environ.get('HOME')}/homebrew/sbin",
f"{os.environ.get('HOME')}/sbin",
]
for p in extrapaths:
if os.path.isdir(p):
logging.info("Adding %s to $PATH", p)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "lima-plugin"
version = "0.1.0"
version = "1.3.3"
description = "Xbar and Swiftbar plugin to control lima"
authors = ["Joe Block <[email protected]>"]
license = "Apache 2.0"
Expand Down