diff options
| -rw-r--r-- | README.md | 24 |
1 files changed, 15 insertions, 9 deletions
| @@ -7,8 +7,12 @@ gist fetch | |||
| 7 | gist | 7 | gist |
| 8 | # create a new gist | 8 | # create a new gist |
| 9 | gist new | 9 | gist new |
| 10 | # edit files in your third gist(default action), and get the path | 10 | # create private gist with files 'foo' and 'bar' |
| 11 | gist new -p foo bar | ||
| 12 | # get the path of cloned repo of your third gist | ||
| 11 | gist 3 | 13 | gist 3 |
| 14 | # cd to the cloned repo | ||
| 15 | cd `gist 3` | ||
| 12 | # push changes in your third gist to the remote repo | 16 | # push changes in your third gist to the remote repo |
| 13 | gist push 3 | 17 | gist push 3 |
| 14 | # update the description of your third gist | 18 | # update the description of your third gist |
| @@ -101,18 +105,20 @@ Use `gist config folder <prefered-directory>` to set the value if needed. | |||
| 101 | Use `gist config auto_sync false` to disable this feature. | 105 | Use `gist config auto_sync false` to disable this feature. |
| 102 | 106 | ||
| 103 | ### action | 107 | ### action |
| 104 | **[Optional]** A custom action is performed when you do `gist <index-of-gist>` (like `gist 3` for your third gist). If is being set, `gist` will automatically cd to the folder of gist repo, and just simply use `eval` to perform action. Default to be | 108 | **[Optional]** A custom action is performed when you do `gist <index-of-gist>` (like `gist 3` for your third gist). If is being set, `gist` will `cd` to the cloned repo, and just simply use `eval` to perform action. |
| 109 | |||
| 110 | For 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** | ||
| 105 | ``` | 112 | ``` |
| 106 | ${EDITOR:-vi} . | 113 | gist config action 'tail -n +1 *' |
| 107 | ``` | 114 | ``` |
| 108 | That is, use default editor or vi (if not set) to open the folder where the git repo of this gist is stored. | 115 | or do |
| 109 | |||
| 110 | For example, you can use the following command to change the action into "print the content of files and list filenames". | ||
| 111 | ``` | 116 | ``` |
| 112 | gist config action 'cat *; ls' | 117 | gist config action '${EDITOR:-vi} .' |
| 113 | ``` | 118 | ``` |
| 119 | That is, use default editor or vi (if not being set) to open the cloned repo. | ||
| 114 | 120 | ||
| 115 | Also, if you run `gist <index-of-gist>` with `--no-action`, then action would not performs. | 121 | Also, if you run `gist <index-of-gist>` with `--no-action`, then action would be ignored. |
| 116 | 122 | ||
| 117 | ### EDITOR | 123 | ### EDITOR |
| 118 | **[Optional]** Editor to open `~/.config/gist.conf`. Default to be `vi` . | 124 | **[Optional]** Editor to open `~/.config/gist.conf`. Default to be `vi` . |
| @@ -142,7 +148,7 @@ But since `gist` is a bash script which goes in subshell, if you want to achieve | |||
| 142 | And run `cdgist 3` to jump to the repo of your third gist. | 148 | And run `cdgist 3` to jump to the repo of your third gist. |
| 143 | 149 | ||
| 144 | ### Useful action for gist repo | 150 | ### Useful action for gist repo |
| 145 | Though default [`action`](#action) is to open gist repo in vi, I strongly recommend use [`tig`](https://github.com/jonas/tig) instead. It is the most powerful git CLI tool as far as I know, and also easy to get in most of the Linux distros and Homebrew for mac. Give it a try! | 151 | I strongly recommend using [`tig`](https://github.com/jonas/tig) as [action](#action). It is the most powerful git CLI tool as far as I know, and also easy to get in most of the Linux distros or Homebrew for mac. Give it a try! |
| 146 | 152 | ||
| 147 | If [`tig`](https://github.com/jonas/tig) is installed, run the following command to configure it as custom action: | 153 | If [`tig`](https://github.com/jonas/tig) is installed, run the following command to configure it as custom action: |
| 148 | 154 | ||