From a3225f170749e09b8986fe8d2862d06ca59dabed Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 1 Apr 2020 09:44:27 +0800 Subject: update --- README.md | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index da70fdb..ca5badc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ -# gist - Manage your gist like a pro +# [[gist]] - Manage your gist like a pro ## Getting started + ```bash # fetch your gists and clone them into ~/gist as git repos gist fetch @@ -9,10 +10,8 @@ gist gist new # create private gist with files 'foo' and 'bar' gist new -p foo bar -# get the path of cloned repo of your third gist +# get the path and cd to cloned repo with subshell gist 3 -# cd to the cloned repo -cd `gist 3` # push changes in your third gist to the remote repo gist push 3 # update the description of your third gist @@ -26,8 +25,9 @@ gist github 3 # For more detail, read the helper message gist help ``` + ## Commands -### Update information and clone gists from Github +### Update and clone gists from Github Run `gist fetch` to fetch your all gists with Github API and keep short information for each gist in a index file inside a given folder. (default to `~/gist/index`) - Automatically Clone/Pull each gist with git into a given folder. (default to `~/gist/`) - Run `gist fetch star` to fetch you starred gist @@ -35,18 +35,21 @@ Run `gist fetch` to fetch your all gists with Github API and keep short informat ### List your gists Run `gist` to read index file (default to `~/gist/index`) and list your gists with the folloing format: -``` +``` [index] [gist-URL] [files-number] [comments-number] [description] ``` -like following: -![](https://i.imgur.com/CP6ZL2G.png) -- Use `gist star` to show your starred gist +like the following: + +![](https://i.imgur.com/ZCLGZLW.png) + +- Use `gist star` to show your starred gists +- Use `gist all` to show your and starred gists - Index with prefix `s` is a starred gist, index with prefix `p` is a private gist - There are colorful hints for each gist in the following cases: - **working:** some changes are made locally but not yet do `git commit`, or you are not in `master` branch - - **ahead:** your local head is yet to be applied to upstream - - **outdated:** your local head is differs from the last fetched gists, do `gist fetch` to refresh index file and pull if needed + - **ahead:** your local **HEAD** is yet to be applied to upstream + - **outdated:** your local **HEAD** is differs from the last fetched gists, do `gist fetch` to refresh index file and pull if needed ### Create a new gist Run `gist new` to create a new gist @@ -109,11 +112,11 @@ Use `gist config auto_sync false` to disable this feature. For example, you can use the following command to set the action for: **print the filename and its content of all files inside the given gist** -``` +```bash gist config action 'tail -n +1 *' ``` or do -``` +```bash gist config action '${EDITOR:-vi} .' ``` That is, use default editor or vi (if not being set) to open the cloned repo. @@ -134,6 +137,21 @@ valid values are: For example, use `gist config protocol ssh` to use SSH protocol instead. ## Tips +### Index Range +```bash +# show gists from index 5 +gist 5- +# show starred gists from index s3 +gist s3- +# only show gists with index 5 to 10 +gist 5-10 +``` + +### Filter +```bash +gist tag tag1 | gist grep pattern1 | gist lan SHELL +``` + ### Git Branching Each gist is a git repository. Although there are some limits on `git push`, like sub-directory. But guess what? Push another branch to `github.com` is allowed. So why not use this feature for your gist workflow? @@ -152,12 +170,12 @@ But since `gist` is a bash script which goes in subshell, if you want to achieve ### Suppress hint If [action](#action) is not configured, there is always a hint to show how to configure it. The following command can suppress it with a simple action that does nothing. -``` +```bash gist config action 'true' ``` There are serveral environment variables can suppress hint or user confirm, like: -``` +```bash # show list without hint hint=false gist @@ -175,6 +193,6 @@ I strongly recommend using [`tig`](https://github.com/jonas/tig) as [action](#ac If [`tig`](https://github.com/jonas/tig) is installed, run the following command to configure it as custom action: -``` +```bash gist config action 'tig -all' ``` -- cgit v1.2.3-70-g09d2