From 55778710eaf6661ec916984f3eb610268d4e95cf Mon Sep 17 00:00:00 2001 From: "Hemanth.HM" Date: Fri, 17 Jul 2015 13:01:25 +0530 Subject: [PATCH] Support alternatives in tips. --- .doxie.render.js | 9 +++++++-- README.md | 6 ++++++ contributing.md | 7 ++++--- tips.json | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.doxie.render.js b/.doxie.render.js index ad9ac8b..82673fa 100644 --- a/.doxie.render.js +++ b/.doxie.render.js @@ -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; diff --git a/README.md b/README.md index ff2e852..2e47a92 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,12 @@ git remote set-url origin git remote ``` + +__Alternatives:__ +```sh +git remote show +``` + ## Get list of all local and remote branches ```sh git branch -a diff --git a/contributing.md b/contributing.md index 62afd01..a30ea54 100644 --- a/contributing.md +++ b/contributing.md @@ -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": , - "tip": + "tip": , + "alternatives": [Optional list of alternatives] } ``` diff --git a/tips.json b/tips.json index 2d3200f..d208786 100644 --- a/tips.json +++ b/tips.json @@ -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",