adding more functions and ssh config

master
Cian Hatton 3 years ago
parent f5b20b5556
commit 9d2b1396b5

@ -10,11 +10,13 @@ function _branches() {
}
function cb() {
branch=$(_branches)
git checkout "${branch}"
gh co
# gh alias set co --shell 'id="$(gh pr list -L100 | fzf | cut -f1)"; [ -n "$id" ] && gh pr checkout "$id"'
# branch=$(_branches)
# git checkout "${branch}"
}
# gh pr list | fzf | awk '{print $1}' | gh pr view --web
function _parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@ -27,12 +29,84 @@ function monitors() {
export PS1='\[\e[1;91m\][\w]\[\e[0m\]\[\e[32m\]$(_parse_git_branch)\[\e[00m\]$ '
#######################
# gh utility functions
#######################
function _get_pr_id(){
if [ -n "$1" ]; then
echo "$1"
return
else
gh pr list --limit 100 | fzf | awk '{print $1}'
fi
}
function _get_issue_id(){
if [ -n "$1" ]; then
echo "$1"
return
else
gh issue list --limit 100 | fzf | awk '{print $1}'
fi
}
function _get_my_pr_id(){
if [ -n "$1" ]; then
echo "$1"
return
else
gh pr list --author @me | fzf | awk '{print $1}'
fi
}
function _get_my_issue_id(){
if [ -n "$1" ]; then
echo "$1"
return
else
gh issue list --limit 100 --assignee @me | fzf | awk '{print $1}'
fi
}
# pr_view opens a pr selected interactively in a browser
function pr_view(){
local pr_id="$(_get_pr_id)"
gh pr view "${pr_id}" --web
}
# my_pr_view opens once of my prs selected interactively in a browser
function my_pr_view(){
local pr_id="$(_get_my_pr_id)"
gh pr view "${pr_id}" --web
}
# pr_view opens a pr selected interactively in a browser
function issue_view(){
local issue_id="$(_get_issue_id)"
gh issue view "${issue_id}" --web
}
function my_issue_view(){
local issue_id="$(_get_my_issue_id)"
gh issue view "${issue_id}" --web
}
# my_pr_view opens once of my prs selected interactively in a browser
function my_pr_view(){
local pr_id="$(_get_my_pr_id)"
gh pr view "${pr_id}" --web
}
# my_issues lists issues assinged to me
function my_issues(){
gh issue list --assignee @me
}
# my_prs lists all prs that I've created
function my_prs(){
gh issue list --assignee @me
gh pr list --author @me
}
# new_issue_branch creates an issue branch based off of a github issue
@ -41,3 +115,5 @@ function new_issue_branch() {
local issueDescription=$(gh issue view ${issueNumber} --repo cosmos/ibc-go --json title | jq -r .title | awk '{print tolower($0)}' | tr " " - | sed s/'[`:()]'//g)
git checkout -b "cian/issue#${issueNumber}-${issueDescription}"
}
. "$HOME/.cargo/env"

@ -0,0 +1,3 @@
Host qnap
HostName qnap
User cianhatton
Loading…
Cancel
Save