mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-10 05:12:56 +00:00
use fish for repos downloading
This commit is contained in:
parent
b9747c4e6f
commit
13a4cac980
@ -20,7 +20,18 @@ selected=$(gh repo list "$organization" \
|
|||||||
--header-lines=1 \
|
--header-lines=1 \
|
||||||
--layout=reverse \
|
--layout=reverse \
|
||||||
--bind "ctrl-o:execute:gh repo view -w ${organization}/{1}" \
|
--bind "ctrl-o:execute:gh repo view -w ${organization}/{1}" \
|
||||||
|
--bind "shift-up:preview-half-page-up" \
|
||||||
|
--bind "shift-down:preview-half-page-down" \
|
||||||
--preview "GH_FORCE_TTY=49% gh repo view ${organization}/{1} | glow -" \
|
--preview "GH_FORCE_TTY=49% gh repo view ${organization}/{1} | glow -" \
|
||||||
--preview-window up
|
--preview-window up
|
||||||
)
|
)
|
||||||
[ -n "${selected}" ] && gh repo clone "${organization}/$(echo "${selected}" | awk '{print $1}')"
|
[ -n "${selected}" ] && {
|
||||||
|
directory="$HOME/dev/work"
|
||||||
|
if [ $organization = "nmasur" ]; then directory="$HOME/dev/personal"; fi
|
||||||
|
repo=$(echo "${selected}" | awk '{print $1}')
|
||||||
|
repo_full="${organization}/${repo}"
|
||||||
|
if [ ! -d "${directory}/${repo}" ]; then
|
||||||
|
gh repo clone "$repo_full" "${directory}/${repo}"
|
||||||
|
fi
|
||||||
|
echo "${directory}/${repo}"
|
||||||
|
}
|
42
fish.configlink/functions/repos.fish
Executable file
42
fish.configlink/functions/repos.fish
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/local/bin/fish
|
||||||
|
|
||||||
|
function repos --description 'Clone GitHub repositories' -a 'organization'
|
||||||
|
set directory (gh-repos $organization)
|
||||||
|
and cd $directory
|
||||||
|
end
|
||||||
|
#switch $organization
|
||||||
|
# case t2; set organization "take-two"
|
||||||
|
# case d2c; set organization "take-two-t2gp"
|
||||||
|
# case t2gp; set organization "take-two-t2gp"
|
||||||
|
# case pd; set organization "private-division"
|
||||||
|
# case dots; set organization "playdots"
|
||||||
|
# case '*'; set organization "nmasur"
|
||||||
|
#end
|
||||||
|
|
||||||
|
#set selected (gh repo list "$organization" \
|
||||||
|
# --limit 50 \
|
||||||
|
# --no-archived \
|
||||||
|
# --json=name,description,isPrivate,updatedAt,primaryLanguage \
|
||||||
|
# | jq -r '.[] | .name + "," + if .description == "" then "-" else .description end + "," + .updatedAt + "," + .primaryLanguage.name' \
|
||||||
|
# | begin
|
||||||
|
# echo "REPO,DESCRIPTION,UPDATED,LANGUAGE"
|
||||||
|
# cat -
|
||||||
|
# end | column -s , -t
|
||||||
|
# | fzf \
|
||||||
|
# --header-lines=1 \
|
||||||
|
# --layout=reverse
|
||||||
|
#--bind "ctrl-o:execute:gh repo view -w $organization/{1}" \
|
||||||
|
#--preview "GH_FORCE_TTY=49% gh repo view $organization/{1} | glow -" \
|
||||||
|
#--preview-window up
|
||||||
|
#)
|
||||||
|
#if test -n (echo $selected | tr -d '\r')
|
||||||
|
# set directory "$HOME/dev/work"
|
||||||
|
# if test $organization = "nmasur"
|
||||||
|
# set directory "$HOME/dev/personal"
|
||||||
|
# end
|
||||||
|
# set repo (echo $selected | awk '{print $1}')
|
||||||
|
# set repo_full "$organization/$repo"
|
||||||
|
# gh repo clone "$repo_full" "$directory/$repo"
|
||||||
|
# cd "$directory/$repo"
|
||||||
|
#end
|
||||||
|
#end
|
Loading…
Reference in New Issue
Block a user