Skip to content

Commit

Permalink
fix ansi color for iterm2 on macosx
Browse files Browse the repository at this point in the history
  • Loading branch information
Giacomo Zinetti committed Sep 6, 2016
1 parent 60bbb1a commit b193434
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var events = require('events');

var inquirer = require('inquirer');

var stripAnsi = require('strip-ansi');


// ---

Expand Down Expand Up @@ -62,14 +64,14 @@ module.exports = function gitBranchCheckout(exec, options) {

function onBranchChosen(answers) {
exec(
'git checkout ' + answers.branches,
'git checkout ' + stripAnsi(answers.branches),
onCheckout.bind(null, answers.branches)
);
}

function onCheckout(branchName, err, stdout, stderr) {
if(!validateExec(err, stdout, stderr)){
result.emit('success', 'Switched to branch \'' + branchName.trim() + '\'');
result.emit('success', 'Switched to branch \'' + branchName.trim() + '\'');
}
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
],
"dependencies": {
"inquirer": "^0.8.x",
"simple-output": "^1.0.x"
"simple-output": "^1.0.x",
"strip-ansi": "^3.0.1"
},
"devDependencies": {
"mocha": "*"
Expand Down

0 comments on commit b193434

Please sign in to comment.