using github client - gh
https://cli.github.com/manual/gh_gist
add --public for creating public gist; if not given, by default created - secret
$ gh gist create --public hello.py
# create a gist with a description
$ gh gist create hello.py -d "my Hello-World program in Python"
# create a gist containing several files
$ gh gist create hello.py world.py cool.txt
lists the gists created in your account
# list all
$ gh gist list
# add --public
# Show only public gists
$ gh gist list --public
# add --secret
# Show only secret gists
$ gh gist list --secret
edits the existing created gist
$ gh gist edit "<id_of_gist>" -f "<file_name_which_needs_to_be_modified>"
# ex
$ gh gist edit 1de.....2b8 -f hello.py
- call the arbitary github api endpoint
- for list of all github apis endpoint visit -
- jq - json query - tutorials - visit - https://jqlang.github.io/jq/tutorial/
# see gists starred by you
$ gh api /gists/starred --jq ".[] | {description: .description,url: .html_url}"
# see the gists created by you
$ gh api /gists --jq ".[] | {description: .description,url: .html_url}"
# need to set the default gist editor (needed for edit!)
$ gh config set editor "code --wait"
- for above to work on windows, created new dir -
C:\Users\%USERNAME%\AppData\Local\Programs\VS_Code
- put the below contents (only pointed the path correctly)
@echo off
setlocal
set VSCODE_DEV=
set ELECTRON_RUN_AS_NODE=1
"%~dp0..\Microsoft VS Code\Code.exe" "%~dp0..\Microsoft VS Code\resources\app\out\cli.js" %*
endlocal