-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add git show-branch command * add doc * cleanup log (remove quiet mode)
- Loading branch information
1 parent
cb98cb8
commit 346ea2a
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
var log = require('fancy-log'); | ||
var exec = require('child_process').exec; | ||
|
||
module.exports = function (opt, cb) { | ||
if (!cb && typeof opt === 'function') { | ||
// optional options | ||
cb = opt; | ||
opt = {}; | ||
} | ||
if (!cb || typeof cb !== 'function') cb = function () {}; | ||
if (!opt) opt = {}; | ||
if (!opt.cwd) opt.cwd = process.cwd(); | ||
if (!opt.args) opt.args = ' '; | ||
|
||
var cmd = 'git show-branch ' + opt.args; | ||
return exec(cmd, {cwd: opt.cwd}, function(err, stdout, stderr) { | ||
if (err) return cb(err); | ||
log(stdout, stderr); | ||
cb(null, stdout); | ||
}); | ||
}; |