Comparing version 1.0.3 to 1.0.4
26
index.js
@@ -6,14 +6,19 @@ #!/usr/bin/env node | ||
const child_process = require('child_process') | ||
const { branchs } = require('./lib/read_gitbranch') | ||
const colors = require('colors') | ||
const spawn = child_process.spawn | ||
const note_git_branch_info = require('./src/read_gitbranch').branchs | ||
const colors = require('colors') | ||
const Promise = global.Promise || require('bluebird') | ||
let git_branch = spawn('git', ['branch']) | ||
let gitBranch = spawn('git', ['branch']) | ||
let output = '' | ||
let native_branch = /^(?: |\n*\* |\n) {0,2}(.*)(?=\n|$)/ | ||
let nativeBranch = /^(?: |\n*\* |\n) {0,2}(.*)(?=\n|$)/ | ||
new Promise((resolve, reject) => { | ||
git_branch.stdout.on('data', (data) => { | ||
resolve(data.toString()) | ||
let branchString = '' | ||
gitBranch.stdout.on('data', (data) => { | ||
branchString += data.toString() | ||
}) | ||
gitBranch.on('close', () => { | ||
resolve(branchString) | ||
}) | ||
}) | ||
@@ -23,12 +28,13 @@ .then(result => { | ||
while(result.length > 0) { | ||
let arr = result.match(native_branch) | ||
let arr = result.match(nativeBranch) | ||
result = result.substring(arr[0].length) | ||
if(~arr[0].indexOf('*')) { | ||
output += `\n* ${arr[1].green}${note_git_branch_info[arr[1]] ? ' - ' + note_git_branch_info[arr[1]].bold.underline : ''}` | ||
output += `\n* ${arr[1].green}${branchs[arr[1]] ? ' - ' + branchs[arr[1]].bold.underline : ''}` | ||
} else { | ||
output += `${arr[0]}${note_git_branch_info[arr[1]] ? ' - ' + note_git_branch_info[arr[1]].bold : ''}` | ||
output += `${arr[0]}${branchs[arr[1]] ? ' - ' + branchs[arr[1]].bold : ''}` | ||
} | ||
} | ||
console.log(output) | ||
process.stdout.write(output) | ||
}) | ||
{ | ||
"name": "branchinfo", | ||
"version": "1.0.3", | ||
"description": "给git分支加注释,来清晰的记录git分支的作用", | ||
"version": "1.0.4", | ||
"description": "Give each git branch a note, to clearly record the role of each branch.", | ||
"main": "index.js", | ||
@@ -9,2 +9,3 @@ "scripts": { | ||
}, | ||
"preferGlobal": true, | ||
"repository": { | ||
@@ -15,10 +16,11 @@ "type": "git", | ||
"bin": { | ||
"gb": "index.js" | ||
"gb": "index.es5.js" | ||
}, | ||
"keywords": [ | ||
"git", | ||
"branch" | ||
"branch", | ||
"info" | ||
], | ||
"author": "", | ||
"license": "ISC", | ||
"author": "Jiang-Xuan", | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -29,4 +31,5 @@ "url": "https://github.com/Jiang-Xuan/gb/issues" | ||
"dependencies": { | ||
"bluebird": "^3.5.0", | ||
"colors": "^1.1.2" | ||
} | ||
} |
# branchinfo | ||
给git分支加注释,解决分支过多无法分辨各个分支的作用的问题 | ||
> Give git branch notes. Because much git branch make me so difficult to understand. | ||
> 给git分支加注释,解决分支过多无法分辨各个分支的作用的问题 | ||
@@ -5,0 +6,0 @@ ## Intro |
Sorry, the diff of this file is not supported yet
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
7716
9
128
1
56
2
2
2
+ Addedbluebird@^3.5.0
+ Addedbluebird@3.7.2(transitive)