Introduce Shell Path Manager [featured]

Published: at 02:26 AM
 | Suggest Changes

Shell Path Manager is a simple and intuitive tool for managing shell path.

I want to develop this tool because I got the problem about managing the PATH on my mac each time after I install something, when I install Go, when I install yarn etc. But I didn’t find any handy tools to satisfy my needs.

This tool is just for simplifying some staff like export $PATH:some-new-path or vi ~/.zshrc, adding something and source ~/.zshrc or restart the terminal.

Some binary tools may auto do this for you but some others don’t. I think they can do this but they don’t have to, so programmers still have to manager shell environment themselves in the end.

But I think it’s a burden for me to do these things each time when I install something, especially as a frontend developer, I just want to install some CLI tools which just used as a binary to create something.

So, I made it.

It makes me easier for some misc staff and I hope it will decrease the complexity for new frontend developers or amateurs.

If it helps you too or any questions, just contact me and pull requests are welcome.

https://github.com/barnett617/shell-path-manager

Installation

curl -fsSL https://raw.githubusercontent.com/barnett617/shell-path-manager/main/tools/install.sh | bash

Above shell script does these things:

Usage & How it works

spm list

This command just does one thing cat ~/.spm/path

spm add go=/Users/mac/go/bin

This command appends the input to ~/.spm/path

spm remove go

This will do following thing:

  1. readline from ~/.spm/path
  2. find the match key of the name to remove
  3. delete the matched line
  4. rewrite to ~/.spm/path
spm uninstall

This will not change your exist path but only remove all things about spm, which is remove rm -rf ~/.spm

Why I made it

See Learning Shell by Making a tool for myself

Some discussion about this pain

Inspiration

There are some projects which I found when I want to decently manager my path before I made this.

Some more things

AFAK Windows users can edit their paths via a visual window at least, so I don’t have any plans to support this tool for Windows.

You may not have Node or proper version of Python on your computer, but you definitely have a shell, no matter Bash or Zsh, so this tool will suit for most Mac users.

Share this post on:
Previous Post
Learning Shell by Making a tool for myself