Skip to content

d-led/pathdebug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pathdebug

a simple interactive & one-shot tool to debug path list environment variables

Go Report Card FOSSA Status Test CodeQL

pathdebug {EnvironmentVariableName}

Features

  • detect duplicate expanded path entries
  • detecting non-existent paths and files
  • best effort of finding out where the path is set
  • interactive mode
  • noninteractive formatted output

Install

Homebrew

brew tap d-led/d-led
brew install pathdebug

Chocolatey

choco install pathdebug

see package at Chocolatey

From Source

go install

from github:

go install github.com/d-led/pathdebug@latest

Alternatively, download the binary from Github releases.

On OSX you might need to run sudo xattr -d com.apple.quarantine pathdebug on the downloaded binary.

Download Latest Release

OSX:

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:

pathdebug --help

Interactive

export SOME_PATH='/sbin:~/.bashrc:/a:/b:/a:/c:/d:/e:/f:/g'
pathdebug SOME_PATH

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:

+---+--------+-----+----------------------------------+-----------------+
| # | 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

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

FOSSA Status