https://github.com/d-led/pathdebug
debug path list environment variables
https://github.com/d-led/pathdebug
Last synced: about 1 year ago
JSON representation
debug path list environment variables
- Host: GitHub
- URL: https://github.com/d-led/pathdebug
- Owner: d-led
- License: mpl-2.0
- Created: 2023-03-13T20:06:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-04T19:40:52.000Z (over 1 year ago)
- Last Synced: 2025-04-14T04:15:00.192Z (about 1 year ago)
- Language: Go
- Size: 175 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pathdebug
a simple interactive & one-shot tool to debug path list environment variables
[](https://goreportcard.com/report/github.com/d-led/pathdebug)
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fd-led%2Fpathdebug?ref=badge_shield)
[](https://github.com/d-led/pathdebug/actions/workflows/test.yml)
[](https://github.com/d-led/pathdebug/actions/workflows/codeql.yml)
```bash
pathdebug {EnvironmentVariableName}
```
## Features
- detect duplicate expanded path entries
- detecting non-existent paths and files
- best effort of **finding out where the path is set**
- [known startup script locations](common/known_paths.go), such as `.bashrc`
- `/etc/path.d` path lists
- recursive follow-ups of `source $file`-like statements in the above scripts
- interactive mode
- noninteractive formatted output
## Install
### Homebrew
```bash
brew tap d-led/d-led
brew install pathdebug
```
### Chocolatey
```shell
choco install pathdebug
```
see package at [Chocolatey](https://community.chocolatey.org/packages/pathdebug)
### From Source
```bash
go install
```
from github:
```bash
go install github.com/d-led/pathdebug@latest
```
Alternatively, download the binary from [Github releases](https://github.com/d-led/pathdebug/releases/).
On OSX you might need to run `sudo xattr -d com.apple.quarantine pathdebug` on the downloaded binary.
### Download Latest Release
OSX:
```bash
curl -s -L https://github.com/d-led/pathdebug/releases/latest/download/pathdebug_Darwin_all.tar.gz | tar xvz - pathdebug
```
Linux: same procedure, but substitute the artifact name with the appropriate one.
## Usage
help:
```bash
pathdebug --help
```
### Interactive
```bash
export SOME_PATH='/sbin:~/.bashrc:/a:/b:/a:/c:/d:/e:/f:/g'
pathdebug SOME_PATH
```
↓
```text
tap Esc/q/Ctrl-C to quit, <-/-> to paginate
+---+--------+-----+-----------+
| # | DUP[#] | BAD | PATH |
+---+--------+-----+-----------+
| 1 | | | /sbin |
| 2 | | F | ~/.bashrc |
| 3 | 5 | X | /a |
| 4 | | X | /b |
| 5 | 3 | X | /a |
| 6 | | X | /c |
+---+--------+-----+-----------+
•○
```
and for the path variable with source detection:
```text
+---+--------+-----+----------------------------------+-----------------+
| # | DUP[#] | BAD | PATH | ±SOURCES |
+---+--------+-----+----------------------------------+-----------------+
| 1 | | | /Users/d/.opam/default/bin | |
| 2 | | | /Users/d/.local/share/ponyup/bin | ~/.zshrc |
| 3 | | | /usr/local/sbin | ~/.zshrc |
| 4 | | | /opt/homebrew/bin | ~/.bash_profile |
| 5 | | | /opt/homebrew/sbin | |
+---+--------+-----+----------------------------------+-----------------+
•○○○○○
```
### Direct Output
```bash
pathdebug PATH -o table
```
see help for other formats
## Limitations
- finding the sources where the `PATH` variable entries are set is best-effort, and is done only for the `PATH` environment variable at present
- path set by executables currently not tracked as sources
- CSV output may lag in output completeness
## License
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fd-led%2Fpathdebug?ref=badge_large)