Skip to content

demartini/pathtoolkit.fish

Logo

pathtoolkit.fish

Smart PATH management toolkit for Fish Shell.

Contributors Forks Stargazers Issues License

Table of Contents

About

Managing your $PATH can be tedious and error-prone. Duplicate entries, invalid directories, or forgotten modifications can break scripts or slow down your terminal startup.

pathtoolkit.fish provides a comprehensive set of commands to view, clean, modify, backup, and restore your PATH environment in Fish Shell — all safely and interactively.

It helps you keep your PATH clean, consistent, and reversible without manually editing config files.

(back to top)

Features

  • 🌐 Pretty-print $PATH entries with indices
  • ⚠ Detect duplicate PATH entries
  • ❌ Detect invalid/non-existent directories
  • 🧪 Dry-run PATH cleaning
  • ✅ Apply PATH cleaning and remove duplicates
  • 🗑 Remove specific PATH entries
  • 💾 Backup and restore PATH
  • ⏪ Undo previous PATH modifications
  • 🐚 Fully native Fish Shell script, no dependencies
  • 🔁 Interactive menu for easy PATH management
  • 💡 Tips and hints embedded for safer usage

(back to top)

Requirements

  • Fish Shell v3.0+
  • Unix-like environment (Linux/macOS)

(back to top)

Installation

Install with Fisher:

fisher install demartini/pathtoolkit.fish

(back to top)

Usage

Interactive Menu

Launch the interactive PATH management menu:

path_toolkit

Sample interactive menu:

===============================
   Fish PATH Toolkit Interactive
===============================

Last actions:
  1) clean PATH applied
  2) removed: /home/user/old_bin

1) Print PATH nicely
2) Check duplicate/invalid PATH entries
3) Dry-run clean
4) Apply clean
5) Remove PATH entry
6) Backup current PATH
7) Restore PATH from backup
8) Undo modifications
9) Exit

Enter a number (1-9):

💡 Tip: After executing a command, press Enter to return to the menu.

Flags / Commands

Command Description
path_toolkit Open interactive menu
path_toolkit --pretty Print PATH nicely
path_toolkit --check-duplicates Check duplicate/invalid PATH entries
path_toolkit --clean Dry-run clean
path_toolkit --clean-apply Apply clean
path_toolkit --remove <path> Remove PATH entry
path_toolkit --backup Backup current PATH
path_toolkit --restore Restore PATH from backup
path_toolkit --undo Undo modifications
path_toolkit --help Show this help
path_toolkit --version Print version information

💡 Tip: You can also use an alias ptk for path_toolkit.

Example output

🌐 PATH entries:
  1. /usr/local/bin
  2. /usr/bin
  3. /bin

🧑‍💻 fish_user_paths entries:
  1. /home/user/.local/bin

⚠ Found 1 duplicate PATH entries:
  1. /usr/local/bin

✗ Found 1 invalid directories:
  1. /home/user/old_bin

🧪 Dry-run mode — showing what would change:
Old PATH:
  /usr/local/bin:/usr/bin:/bin:/usr/local/bin:/home/user/old_bin

New PATH:
  /usr/local/bin:/usr/bin:/bin

✔ PATH cleaned successfully.

(back to top)

Contributing

If you want to help, check our contribution guidelines and open an issue or pull request.

(back to top)

Changelog

See CHANGELOG for a human-readable history of changes.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

About

Smart PATH management toolkit for Fish Shell.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Contributors

Languages