Skip to content

metafates/pat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pat 🐝

$PATH Manager

pat.mp4

Table of contents

What is this?

Have you ever found yourself searching something like "Adding a new entry to the PATH variable in ZSH", "How to delete entry from PATH in bash", "How to change order of the PATH entries in fish"...? And then you forget how to do it and search it again, again and again... ughh, this is annoying πŸ’€

Try Pat! It's a $PATH environment variable manager. It can reorder, delete and add new path entries with a fancy and easy TUI, so you don't have to remember any commands.

Note Pat is a work in progress, so bugs and missing features are expected. If you find any, please open an issue.

Okay, let's move on!

How to use?

Let's assume you're a ZSH user and want to add ~/playground/scripts to your $PATH.

fish and bash are also supported, it's just an example

No need for any extra arguments or preconfiguration just run

pat

It will welcome you with this screen. Select zsh (you can move up by pressing arrow up ↑ or h and ↓/j to move down)

Screenshot 2022-10-14 at 21 35 23

You will see your paths.

Screenshot 2022-10-14 at 21 37 02

You can preview each (check what executables it contains) by pressing p (acronym for preview)

Screenshot 2022-10-14 at 22 02 48

Press esc to go back.

Press a (for add) to add a new path. It will open a text input with smart hints and autocompletion so you won't be lost or misspell something while typing

See, pat is smart! It will provide you autocompletions while typing

Screenshot 2022-10-14 at 21 41 24

Press tab to accept completion

Screenshot 2022-10-14 at 21 41 41

Press enter to confirm

Screenshot 2022-10-14 at 21 42 43

Almost there! Now you will need to save it. Simply press s or enter to save. Don't worry it will ask you to confirm your actions before applying anything

Screenshot 2022-10-14 at 21 43 54

Press Y (uppercase y) to confirm. This keybind is inconvenient on purpose so you won't do anything accidentally

LAST STEP. You will need to do it only once and forget forever!

Basically, you will need to source file generated by pat as the last thing in your shell config file.

echo 'source $(pat where --zsh) &>/dev/null' >> ~/.zshenv

For any other shell steps are the same, except for the last one

For Fish

# If you know what you're doing, you can change config.fish to other file of course
echo 'source (pat where --fish) &>/dev/null' >> ~/.config/fish/config.fish

For Bash

echo 'source $(pat where --bash) &>/dev/null' >> ~/.bashrc

Installation

Install Precompiled

With curl

curl -sSL pat.metafates.one/install | sh

With wget

wget -qO- pat.metafates.one/install | sh

This will install pat to the ~/.pat/bin and automatically add it to your $PATH

If it finds that pat is already installed it will update it wherever it is installed

Compile from source

Compile from source with make

git clone https://github.com/metafates/pat.git
cd pat
make install

Keybinds

Keybind Action
p Preview executables of the selected path
d Move the selected path 1 position down
u Move the selected path 1 position up
a Add a new path
enter Select, Confirm
Y Confirm actions
d Remove selected path from $PATH
s Save
c Copy selected path
backspace Undo unsaved changes

See also pat help to show available commands.

For example, pat config info

About

🐝 $PATH manager for bash, zsh & fish. Featuring shining TUI!

Resources

License

Stars

Watchers

Forks

Packages

No packages published