1
0
mirror of https://github.com/namibia/tips.git synced 2024-12-22 10:08:58 +00:00

Support alternatives in tips.

This commit is contained in:
Hemanth.HM 2015-07-17 13:01:25 +05:30
parent a082bb79d2
commit 55778710ea
4 changed files with 18 additions and 6 deletions

View File

@ -7,13 +7,18 @@ function escapeStr(str) {
var render = function(data) { var render = function(data) {
var data = data.data; var data = data.data;
return [ var tips = [
'## ' + data.title, '## ' + data.title,
'```sh', '```sh',
data.tip, data.tip,
'```', '```',
'\n' '\n'
].join('\n'); ];
Array.isArray(data.alternatives) && tips.push(['__Alternatives:__']) &&
data.alternatives.map(function(alternative){
tips = tips.concat(['```sh',alternative,'```','\n'])
});
return tips.join('\n');
}; };
module.exports = render; module.exports = render;

View File

@ -98,6 +98,12 @@ git remote set-url origin <URL>
git remote git remote
``` ```
__Alternatives:__
```sh
git remote show
```
## Get list of all local and remote branches ## Get list of all local and remote branches
```sh ```sh
git branch -a git branch -a

View File

@ -2,17 +2,18 @@
* [Fork](https://github.com/git-tips/tips/network) the repo. * [Fork](https://github.com/git-tips/tips/network) the repo.
* Install the deps: * Install the deps:
```sh ```sh
$ cd tips && npm install $ cd tips && npm install
``` ```
* Edit [tips.json](./tips.json) to add your tip in the below format: * Edit [tips.json](./tips.json) to add your tip in the below format:
```js ```js
{ {
"title": <your_tip_title>, "title": <your_tip_title>,
"tip": <your_tip> "tip": <your_tip>,
"alternatives": [Optional list of alternatives]
} }
``` ```

View File

@ -54,7 +54,7 @@
{ {
"title": "Get list of all remote references", "title": "Get list of all remote references",
"tip": "git remote", "tip": "git remote",
"alternatives": "git remote show" "alternatives": ["git remote show"]
}, },
{ {
"title": "Get list of all local and remote branches", "title": "Get list of all local and remote branches",