feat: respect direnv log filter

This commit is contained in:
2026-03-19 00:38:25 +02:00
parent 59be02fc34
commit 8e2cbdc6fa
3 changed files with 43 additions and 2 deletions

12
.github/workflows/manual-homebrew-release.yml vendored Executable file
View File

@@ -0,0 +1,12 @@
name: Manual Homebrew Release
on:
workflow_dispatch:
jobs:
homebrew:
uses: chenasraf/workflows/.github/workflows/manual-homebrew-release.yml@master
with:
homebrew-tap-repo: chenasraf/homebrew-tap
secrets:
REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}

View File

@@ -14,6 +14,9 @@ jobs:
release-please:
name: Release
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
@@ -21,3 +24,14 @@ jobs:
id: release
with:
release-type: simple
release-homebrew:
name: Homebrew Release
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
uses: chenasraf/workflows/.github/workflows/homebrew-release.yml@master
with:
homebrew-tap-repo: chenasraf/homebrew-tap
tag: ${{ needs.release-please.outputs.tag_name }}
secrets:
REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}

View File

@@ -1,5 +1,20 @@
#!/usr/bin/env bash
_dotenvx_log() {
local msg="$1"
if [ -z "$_dotenvx_log_filter" ]; then
local config_home="${XDG_CONFIG_HOME:-$HOME/.config}"
local config_file="$config_home/direnv/direnv.toml"
if [ -f "$config_file" ]; then
_dotenvx_log_filter=$(sed -n 's/^[[:space:]]*log_filter[[:space:]]*=[[:space:]]*"\(.*\)"/\1/p' "$config_file")
fi
_dotenvx_log_filter="${_dotenvx_log_filter:-.*}"
fi
if [[ "$msg" =~ $_dotenvx_log_filter ]]; then
printf "%s\n" "$msg" >&2
fi
}
use_dotenvx() {
local env_file=".env.${1:-default}"
local dotenvx_env=()
@@ -11,7 +26,7 @@ use_dotenvx() {
elif [ -f ".env" ]; then
used_file=".env"
else
echo "use_dotenvx: no .env file found" >&2
_dotenvx_log "use_dotenvx: no .env file found"
return 0
fi
@@ -25,7 +40,7 @@ use_dotenvx() {
added_vars=$(comm -13 "$old_env" "$new_env" | grep '=')
if [ -n "$added_vars" ]; then
printf "use_dotenvx: loaded variables from %s\n" "$used_file" >&2
_dotenvx_log "use_dotenvx: loaded variables from $used_file"
fi
local EXCLUDE_KEYS=("_" "PKG_EXECPATH")