Skip to content

Instantly share code, notes, and snippets.

@potatoqualitee
Created October 10, 2020 13:02
Show Gist options
  • Save potatoqualitee/0e060d263fe0bc54984a7f1935c84574 to your computer and use it in GitHub Desktop.
Save potatoqualitee/0e060d263fe0bc54984a7f1935c84574 to your computer and use it in GitHub Desktop.
# ???? Blammo ????
Get-ChildItem | gh gist create
#region issues
cd C:\github\dbatools
gh issue list
gh issue view 6886
# easy to understand visuals and navigation - RUN THIS ON PS CORE!
gh issue list -R powershell/powershell | Out-ConsoleGridView
#prompts for input
gh issue create
#endregion
#region core gh
# Don't have to remember commands, they're very straightforward
# Note that while it can interaction, it can also be 100% not interactive
gh
# Autocomplete provided!
gh completion --shell powershell >> $profile
. $profile
#region jk
# just kidding! Add this to $profile instead
Invoke-Expression (@(gh completion -s powershell) -replace " ''\)$", " ' ')" -join "`n")
# do ctrl-space
#endregion
#endregion
#region login
Invoke-Item "$home\.config\gh"
Invoke-Item C:\temp\login-logout.mp4
# gh auth logout
# dem prompts, created with the beginners in mind ????
#gh auth login
#endregion
#region pr
cd C:\github\dbatools
gh pr list
# lots of information is presented, but it's easy to understand
gh pr diff 6868
# no branching built in (yet?), but you can switch to a pr branch
# Condenses complicated processes into simple actions
gh pr checkout 6912
# Manage pull requests :O
gh pr review 6912
#gh pr merge 6912 --delete-branch
#endregion
#region clone repo
cd C:\github
gh repo clone https://github.com/potatoqualitee/masktest
#endregion
#region create a repo
cd C:\github
gh repo create clirepo
cd C:\github\clirepo
#endregion
#region Create an issue! Before, you'd have to use a Ruby gem.
gh issue create --title "Update database" --body "Just kidding. This is a test from ``gh issue create``"
gh issue view 1 --web
#endregion
#region old school git
# yuck
"# clirepo" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/potatoqualitee/clirepo.git
git push -u origin main
# then do this
git checkout -b test
"test" | Set-Content test.txt
git add .
git commit -m "Add existing file"
git push --set-upstream origin test
#endregion
#region new pr
# Create a PR (git has request-pull but it's pas bon ????????)
gh pr create --title "Test from the command line" --body "Crosses fingers"
gh pr view --web
#endregion
#region API Fun ????
# ???Swiss army knife???
gh api /users/jaapbrasser/repos | ConvertFrom-Json -OutVariable jaaprepo
$jaaprepo.name
cd C:\github\dbatools
(gh api repos/:owner/:repo/releases | ConvertFrom-Json).Name
cd C:\github\psmodulecache
gh api repos/:owner/:repo/actions
gh api repos/:owner/:repo/workflows
#endregion
#region aliases
cd C:\github\dbatools
gh alias set bugs 'issue list --label="bugs_life"'
gh bugs
gh alias set prweb "pr create --fill --body '' --web"
gh alias set --shell newbranch 'git checkout -b $1'
gh newbranch test2
# want a space? like gh branch list?
gh alias set --shell branch 'if [ $1 == "list" ]
then
git branch -vva
elif [ $1 == "checkout" ]
then
gh checkout $1
else
echo nothing
fi'
gh branch list
# Get positively crazy
# from https://gist.github.com/doi-t/5735f9f0f7f8b7664aa6739bc810a2cc
gh alias set listMilestones "api graphql -F owner=':owner' -F name=':repo' -f query='
query ListMilestones(`$name: String`!, `$owner: String`!) {
repository(owner: `$owner, name: `$name) {
milestones(first: 100) {
nodes {
title
number
description
dueOn
url
state
closed
closedAt
updatedAt
}
}
}
}
'"
#endregion
#region conclude
Get-Content C:\Users\ctrlb\.config\gh\config.yml | gh gist create --public
Get-Content C:\Users\ctrlb\Desktop\gh.ps1 | gh gist create --public
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment