dotfiles/dot_config/fish/functions/hack.fish

20 lines
561 B
Fish
Raw Normal View History

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