Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 1.92 KB

README.md

File metadata and controls

62 lines (43 loc) · 1.92 KB

pathos.rb - CLI for editing a PATH env variable

Background

If you're like me, you might have a number of export PATH statements littering your shell resource file (e.g., .zshrc, .bashrc, etc). Over time, many directory entries get added and revised. Those that remain eventually become unnecessary, are mistakenly duplicated, or represent directories that no longer exist on the system. This is my attempt at cleaning up PATH environment variable. Hopefully, others will find this to be useful.

Demo

pathos.rb DEMO

Built with the following:

Installation

  1. Clone repo
  2. Change to repo directory (Assuming repo was downloaded to ~/Downloads/pathos.rb on MacOS)
cd ~/Downloads/pathos.rb
  1. Run it
ruby pathos.rb

IMPORTANT

Each time you save your changes to the directory list, pathos.rb will build a revised export $PATH statement that is written to $HOME/.pathos.env.

To use the new PATH, $HOME/.pathos.env MUST BE SOURCED to take effect within your shell.

source $HOME/.pathos.env

Navigation / Commands

Key Description
↑/k up
↓/j down
o add path (below current selected path) [1]
O add path (above current selected path) [1]
x remove current path
X remove non-existent paths
D remove duplicate paths
S save
q quit

Color Highlighting

Color Description
  Yellow   Shows current selected path
  Red   Indicates paths that do not exist
  Aqua   Indicates duplicate paths