mirror of
https://github.com/git-tips/tips
synced 2024-11-10 05:44:14 +00:00
Support alternatives in tips.
This commit is contained in:
parent
a082bb79d2
commit
55778710ea
4 changed files with 18 additions and 6 deletions
|
@ -7,13 +7,18 @@ function escapeStr(str) {
|
|||
var render = function(data) {
|
||||
var data = data.data;
|
||||
|
||||
return [
|
||||
var tips = [
|
||||
'## ' + data.title,
|
||||
'```sh',
|
||||
data.tip,
|
||||
'```',
|
||||
'\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;
|
||||
|
|
|
@ -98,6 +98,12 @@ git remote set-url origin <URL>
|
|||
git remote
|
||||
```
|
||||
|
||||
|
||||
__Alternatives:__
|
||||
```sh
|
||||
git remote show
|
||||
```
|
||||
|
||||
## Get list of all local and remote branches
|
||||
```sh
|
||||
git branch -a
|
||||
|
|
|
@ -2,17 +2,18 @@
|
|||
|
||||
* [Fork](https://github.com/git-tips/tips/network) the repo.
|
||||
|
||||
* Install the deps:
|
||||
* Install the deps:
|
||||
```sh
|
||||
$ cd tips && npm install
|
||||
```
|
||||
|
||||
|
||||
* Edit [tips.json](./tips.json) to add your tip in the below format:
|
||||
|
||||
```js
|
||||
{
|
||||
"title": <your_tip_title>,
|
||||
"tip": <your_tip>
|
||||
"tip": <your_tip>,
|
||||
"alternatives": [Optional list of alternatives]
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
{
|
||||
"title": "Get list of all remote references",
|
||||
"tip": "git remote",
|
||||
"alternatives": "git remote show"
|
||||
"alternatives": ["git remote show"]
|
||||
},
|
||||
{
|
||||
"title": "Get list of all local and remote branches",
|
||||
|
|
Loading…
Reference in a new issue