reykjalin/project-picker
CLI to select from a pre-defined list of items with filtering support
84d6cb381c0d628550fac3f6daa24c5faf7b2cd1
aa24df42183ad415d10bc0a33e6238c437fc0f59
63b6df4c610b5198bf291264ae179320ec409a77
Presents a filterable list of pre-defined strings from ~/.config/project-picker/projects
for you to select and provide to some shell command.
Once an item in the list is selected project-picker
will print the full path to STDOUT.
Exit codes:
project-picker
will exit with status 0
.project-picker
will exit with status 1
.Ctrl-C
is used to close project-picker
instead of selecting an item it will exit with status 1
.project-picker
will exit with status 74
and an error message is printed to STDERR.Add a list of the projects you want easily available to a config file, then run project-picker
.
project-picker
will print the selected project path to STDOUT.
~/projects/project-a
~/projects/project-b
/Users/jdoe/projects/project-c
~/projects/sub-projects/*
If you end a path with /*
project-picker
will list all the directories in that folder.
Put in a shell script or alias:
# ~/.config/fish/functions/pp.fish
# Fish alias for project-picker, usage: pp
function pp
set dir (project-picker)
# A non-zero exit code means no project was selected.
if test $status -eq 0
cd $dir
end
end
This is the quick and dirty way to use project-picker
.
If an error occurs or you don't pick an item nothing will be passed to the command.
# `cd` to selected item.
cd $(project-picker)
# Open selected item in vim.
vim $(project-picker)
project-picker
# Will place `project-picker` in ./zig-out/bin
zig build -Doptimize=ReleaseSafe
# Will place `project-picker` in ~/.local/bin
zig build -Doptimize=ReleaseSafe --prefix ~/.local