edryd.org

some of my neat stuff
git clone git://edryd.org/edryd.org
Log | Files | Refs | LICENSE

commit 3888f62f66a4890d11075b571c8a3879c2e519a5
parent 4d59a8940ccd7ae50b5444c150fba67a85d01964
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Thu,  2 Apr 2020 22:53:52 -0700

Rename gs to gst

Diffstat:
_data/projects.yml | 4++--
projects/gs.md | 137-------------------------------------------------------------------------------
projects/gst.md | 160+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 162 insertions(+), 139 deletions(-)

diff --git a/_data/projects.yml b/_data/projects.yml @@ -8,8 +8,8 @@ main: link: 'https://github.com/rain-1/s' - name: 'tisp' desc: 'tiny lisp' - - name: 'gs' - desc: 'gist creator' + - name: 'gst' + desc: 'painless gist creator' - name: 'dmenium' desc: 'small collection of dmenu scripts' - name: 'dmenu.vim' diff --git a/projects/gs.md b/projects/gs.md @@ -1,137 +0,0 @@ ---- -title: gs -description: 'painless gist creator' -tags: c linux cli github gist curl json api suckless simple ---- - -Easy way to create GitHub Gists through the command line. - -## OPTIONS - -#### -e ID - -Edit previously created Gist specified with *ID* - -#### -d DESCRIPTION - -Set Gist description - -#### -D FILE - -Delete *FILE* from Gist being edited - -#### -f FILENAME - -Set file name when reading from `stdin` - -#### -g GITHUB_URL - -Change the GitHub API URL - -#### -p - -Make Gist private - -#### -P - -Make Gist public (default) - -#### -u USER[:PASSWORD] - -Change the GitHub account the Gist will be posted under. A password can -given as well with a separating colon, a prompt is provided if not. - -#### -U - -Post Gist anonymously (default) - -#### -h - -Print help and exit - -#### -v - -Print version info and exit - -## USAGE - -Create a new Gist of file `file.txt`: - -``` -$ gs file.txt -https://gist.github.com/<new-id> -``` - -There is also support for multiple files in a single Gist: - -``` -$ gs README.md Makefile prog.c -https://gist.github.com/<new-id> -``` - -Specify the Gist's description: - -``` -$ gs -d 'a cool shell script' script.sh -https://gist.github.com/<new-id> -``` - -The Gist's URL can be piped to other programs, for example to your clipboard to -be pasted else where: - -``` -$ gs file.txt | xsel -bi -``` - -You can also create a new Gist from `stdin`. The file name needs to be supplied -however: - -``` -$ cmd-which-errors | gs -f log.txt -https://gist.github.com/<new-id> -``` - -New Gists can be private as well: - -``` -$ gs -p personal.info -https://gist.github.com/<new-id> -``` - -The new Gist can be posted under a GitHub user, a prompt will ask for your -password: - -``` -$ gs -u your-name good-proj.rs -GitHub password: -https://gist.github.com/<new-id> -``` - -To skip the prompt your password can be supplied after a colon with the -username: - -``` -$ gs -u your-name:password plugin/func.vim doc/func.txt -https://gist.github.com/<new-id> -``` - -## CUSTOMIZATION - -gs is customized by creating a custom `config.h` and (re)compiling the source -code. This keeps it fast, secure and simple. Most customization can be done -through the command line interface however, so basic aliases could also be -utilized. - -## AUTHOR - -Ed van Bruggen <edvb@uw.edu> - -## SEE ALSO - -See project page at <https://edryd.org/projects/gs.html> - -View source code at <https://git.edryd.org/gs> - -## LICENSE - -zlib License diff --git a/projects/gst.md b/projects/gst.md @@ -0,0 +1,160 @@ +--- +title: gst +description: 'painless gist creator' +tags: c linux cli github gist curl json api suckless simple +--- + +Easy way to create GitHub Gists through the command line. Simply give it the +files to upload and gst will return the URL to the new gist. + +## Options + +#### -e *ID* + +Edit previously created gist specified with *ID* + +#### -d *DESCRIPTION* + +Set gist description + +#### -D *FILE* + +Delete *FILE* from gist being edited + +#### -f *FILENAME* + +Set file name when reading from `stdin` + +#### -g *URL* + +Change the GitHub API URL (default: https://api.github.com/gists) + +#### -p + +Make gist private + +#### -P + +Make gist public (default) + +#### -u *USER[:PASSWORD]* + +Change the GitHub account the gist will be posted under. A password can +given as well with a separating colon, a prompt is provided if not. + +#### -U + +Post gist anonymously (default) + +#### -h + +Print help and exit + +#### -v + +Print version info and exit + +## Usage + +Create a new gist of `file.txt`: + +``` +$ gst file.txt +https://gist.github.com/<new-id> +``` + +There is also support for multiple files in a single gist: + +``` +$ gst README.md Makefile prog.c +https://gist.github.com/<new-id> +``` + +Specify the gist's description: + +``` +$ gst -d 'a cool shell script' script.sh +https://gist.github.com/<new-id> +``` + +The gist's URL can be piped to other programs, for example to your clipboard to +be pasted elsewhere: + +``` +$ gst file.txt | xsel -bi +``` + +You can also create a new gist from `stdin`. The file name needs to be supplied +however: + +``` +$ cmd-which-errors | gst -f log.txt +https://gist.github.com/<new-id> +``` + +The new gist can be posted under a GitHub user, a prompt will ask for your +password: + +``` +$ gst -u your-name good-proj.rs +GitHub password: +https://gist.github.com/<new-id> +``` + +To skip the prompt your password can be supplied after a colon with the +username: + +``` +$ gst -u your-name:password plugin/func.vim doc/func.txt +https://gist.github.com/<new-id> +``` + +New gists can be private when created under a user: + +``` +$ gst -p -u name personal.info +https://gist.github.com/<new-id> +``` + +You can also edit a previously created gist under your account, such as adding +a new file or updating the description: + +``` +$ gst -e <id> -u name -d "new description" additional-file.txt +https://gist.github.com/<id> +``` + +It is even possible to delete files, although it should be noted the gist still +exists even if you delete all the files within it due to the limitations of the +API: + +``` +$ gst -e <id> -u name -D old.py +https://gist.github.com/<id> +``` + +## Installation + +The only dependency needed to build gst is cURL. gst be compiled with a simple +`make` and `sudo make install` will install the executable and man page. + +## Customization + +gst can be customized by editing the custom `config.h` and (re)compiling the +source code. This keeps it fast, secure and simple. All customization can be +done through the command line interface however, so basic aliases could also be +utilized to change default options. + +## Author + +Ed van Bruggen <ed@edryd.org> + +## See Also + +See project page at <https://edryd.org/projects/gst.html> + +View source code at <https://git.edryd.org/gst> + +## License + +zlib License