dotfiles/.config/fish/functions/hack.fish
punkfairie 9be33b8eac
feat(fish): hack script
`hack` no longer cd's to ~/hackin/.  It is now a function that allows
the user to select from their Github repositories, clone it if it
doesn't exist, and enter the project directory.
2024-03-10 15:45:03 -07:00

15 lines
478 B
Fish

#!/usr/bin/env fish
function hack --description "Select a GH repo, [clone it], enter its directory"
set -f repos $(gh repo list --source --no-archived --json name,description --jq '.[] | "\(.name) \u001b[1;30m\(.description)\u001b[0m"')
set -f repo $(gum filter --height 10 $repos | string split ' ')[1]
set -f path "$HOME/hackin/$repo"
if test ! -d $path
echo "Cloning $repo into $path..."
gh repo clone $repo $path
end
cd $path
end