✨ 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.
This commit is contained in:
parent
5fa4cf6d33
commit
9be33b8eac
2 changed files with 15 additions and 5 deletions
|
@ -10,11 +10,6 @@ abbr -a v --position command "$EDITOR"
|
|||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Location aliases.
|
||||
abbr -a hack --position command "cd $HACK"
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Default command options.
|
||||
|
||||
abbr -a cp --position command "cp -iv"
|
||||
|
|
15
.config/fish/functions/hack.fish
Normal file
15
.config/fish/functions/hack.fish
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/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
|
Loading…
Reference in a new issue