aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-04-01 09:44:27 +0800
committertypebrook <typebrook@gmail.com>2020-04-07 11:44:14 +0800
commita3225f170749e09b8986fe8d2862d06ca59dabed (patch)
treea627c931b0e2d6a0a617bbb024aadc8225e41b04
parent2ca0a674f43a18d1e52b8038513faf48ed7ace35 (diff)
update
-rw-r--r--README.md50
1 files changed, 34 insertions, 16 deletions
diff --git a/README.md b/README.md
index da70fdb..ca5badc 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
1# gist - Manage your gist like a pro 1# [[gist]] - Manage your gist like a pro
2## Getting started 2## Getting started
3
3```bash 4```bash
4# fetch your gists and clone them into ~/gist as git repos 5# fetch your gists and clone them into ~/gist as git repos
5gist fetch 6gist fetch
@@ -9,10 +10,8 @@ gist
9gist new 10gist new
10# create private gist with files 'foo' and 'bar' 11# create private gist with files 'foo' and 'bar'
11gist new -p foo bar 12gist new -p foo bar
12# get the path of cloned repo of your third gist 13# get the path and cd to cloned repo with subshell
13gist 3 14gist 3
14# cd to the cloned repo
15cd `gist 3`
16# push changes in your third gist to the remote repo 15# push changes in your third gist to the remote repo
17gist push 3 16gist push 3
18# update the description of your third gist 17# update the description of your third gist
@@ -26,8 +25,9 @@ gist github 3
26# For more detail, read the helper message 25# For more detail, read the helper message
27gist help 26gist help
28``` 27```
28
29## Commands 29## Commands
30### Update information and clone gists from Github 30### Update and clone gists from Github
31Run `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`) 31Run `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`)
32- Automatically Clone/Pull each gist with git into a given folder. (default to `~/gist/`) 32- Automatically Clone/Pull each gist with git into a given folder. (default to `~/gist/`)
33- Run `gist fetch star` to fetch you starred gist 33- 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
35 35
36### List your gists 36### List your gists
37Run `gist` to read index file (default to `~/gist/index`) and list your gists with the folloing format: 37Run `gist` to read index file (default to `~/gist/index`) and list your gists with the folloing format:
38``` 38```
39[index] [gist-URL] [files-number] [comments-number] [description] 39[index] [gist-URL] [files-number] [comments-number] [description]
40``` 40```
41like following:
42![](https://i.imgur.com/CP6ZL2G.png)
43 41
44- Use `gist star` to show your starred gist 42like the following:
43
44![](https://i.imgur.com/ZCLGZLW.png)
45
46- Use `gist star` to show your starred gists
47- Use `gist all` to show your and starred gists
45- Index with prefix `s` is a starred gist, index with prefix `p` is a private gist 48- Index with prefix `s` is a starred gist, index with prefix `p` is a private gist
46- There are colorful hints for each gist in the following cases: 49- There are colorful hints for each gist in the following cases:
47 - **working:** some changes are made locally but not yet do `git commit`, or you are not in `master` branch 50 - **working:** some changes are made locally but not yet do `git commit`, or you are not in `master` branch
48 - **ahead:** your local head is yet to be applied to upstream 51 - **ahead:** your local **HEAD** is yet to be applied to upstream
49 - **outdated:** your local head is differs from the last fetched gists, do `gist fetch` to refresh index file and pull if needed 52 - **outdated:** your local **HEAD** is differs from the last fetched gists, do `gist fetch` to refresh index file and pull if needed
50 53
51### Create a new gist 54### Create a new gist
52Run `gist new` to create a new gist 55Run `gist new` to create a new gist
@@ -109,11 +112,11 @@ Use `gist config auto_sync false` to disable this feature.
109 112
110For example, you can use the following command to set the action for: 113For example, you can use the following command to set the action for:
111**print the filename and its content of all files inside the given gist** 114**print the filename and its content of all files inside the given gist**
112``` 115```bash
113gist config action 'tail -n +1 *' 116gist config action 'tail -n +1 *'
114``` 117```
115or do 118or do
116``` 119```bash
117gist config action '${EDITOR:-vi} .' 120gist config action '${EDITOR:-vi} .'
118``` 121```
119That is, use default editor or vi (if not being set) to open the cloned repo. 122That is, use default editor or vi (if not being set) to open the cloned repo.
@@ -134,6 +137,21 @@ valid values are:
134For example, use `gist config protocol ssh` to use SSH protocol instead. 137For example, use `gist config protocol ssh` to use SSH protocol instead.
135 138
136## Tips 139## Tips
140### Index Range
141```bash
142# show gists from index 5
143gist 5-
144# show starred gists from index s3
145gist s3-
146# only show gists with index 5 to 10
147gist 5-10
148```
149
150### Filter
151```bash
152gist tag tag1 | gist grep pattern1 | gist lan SHELL
153```
154
137### Git Branching 155### Git Branching
138Each 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? 156Each 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?
139 157
@@ -152,12 +170,12 @@ But since `gist` is a bash script which goes in subshell, if you want to achieve
152 170
153### Suppress hint 171### Suppress hint
154If [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. 172If [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.
155``` 173```bash
156gist config action 'true' 174gist config action 'true'
157``` 175```
158 176
159There are serveral environment variables can suppress hint or user confirm, like: 177There are serveral environment variables can suppress hint or user confirm, like:
160``` 178```bash
161# show list without hint 179# show list without hint
162hint=false gist 180hint=false gist
163 181
@@ -175,6 +193,6 @@ I strongly recommend using [`tig`](https://github.com/jonas/tig) as [action](#ac
175 193
176If [`tig`](https://github.com/jonas/tig) is installed, run the following command to configure it as custom action: 194If [`tig`](https://github.com/jonas/tig) is installed, run the following command to configure it as custom action:
177 195
178``` 196```bash
179gist config action 'tig -all' 197gist config action 'tig -all'
180``` 198```