Skip to content

Commit

Permalink
refact(platform)
Browse files Browse the repository at this point in the history
  • Loading branch information
hotoo committed Jul 13, 2015
1 parent 004c39d commit 7a3acea
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions bin/gitopen
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,25 @@ if (!options.scheme) {
//url = url.replace(/^https?/, options.protocol)

var url = GitRemote(options);
var shell;

if (commander.verbose) {
console.log('options:', options);
console.log(url);
console.log('Options:', options);
console.log('URL:', url);
}

var platform = process.platform;
var shell = 'start';

if (platform !== 'win32') {
shell = platform === 'linux' ? 'xdg-open' : 'open';
switch(process.platform){
case 'win32':
case 'win64':
shell = 'start';
break;
case 'unix':
case 'linux':
shell = 'xdg-open';
break;
// case 'darwin':
default:
shell = 'open';
}

child_process.execSync(shell + ' ' + url);
Expand Down

0 comments on commit 7a3acea

Please sign in to comment.