-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- removes commander - converts all synchronous activity to async (no more blocking io) - increased speed 7% [322.030624ms -> 300.058158ms]
- Loading branch information
1 parent
dfff611
commit 636f17d
Showing
13 changed files
with
231 additions
and
2,133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
{ | ||
"extends": "eslint:recommended", | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
} | ||
"extends": "eslint:recommended", | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"quotes": ["error", "single"], | ||
"semi": ["error", "always"], | ||
"no-cond-assign": 0 | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
} | ||
} |
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 |
---|---|---|
|
@@ -58,3 +58,4 @@ typings/ | |
.env | ||
test/fixtures/test1 | ||
.DS_Store | ||
package-lock.json |
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,12 @@ | ||
module.exports = { | ||
title: "git-unstaged", | ||
description: "🎭 Get all unstaged git repos in a folder", | ||
links: { | ||
Source: 'https://github.com/gabrielcsapo/git-unstaged', | ||
Download: 'https://github.com/gabrielcsapo/git-unstaged/releases' | ||
}, | ||
icon: '', | ||
demoImage: './example.gif', | ||
template: 'product', | ||
output: './docs' | ||
} |
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,92 @@ | ||
#!/usr/bin/env node | ||
|
||
const path = require('path'); | ||
const chalk = require('chalk'); | ||
const { search } = require('../lib/search'); | ||
const log = console.log; // eslint-disable-line | ||
|
||
const args = process.argv.slice(2); | ||
let program = {}; | ||
|
||
args.forEach((arg, i) => { | ||
switch (arg) { | ||
case '-v': | ||
case '--version': | ||
case 'version': | ||
console.log(`v${require('../package.json').version}`); // eslint-disable-line | ||
process.exit(0); | ||
break; | ||
case '-h': | ||
case '--help': | ||
case 'help': | ||
console.log(`` + // eslint-disable-line | ||
` | ||
Usage: git-unstaged [options] | ||
Commands: | ||
-h, --help, help Output usage information | ||
-v, --version, version Output the version number | ||
Options: | ||
-b, --baseDirectory [path] The base directory where operations should start from | ||
-d, --depth [value] The specified depth you want to recursively search for git repos | ||
-a, --all Show all git repos and their status | ||
`); | ||
process.exit(0); | ||
break; | ||
case '-d': | ||
case '--depth': | ||
program['depth'] = args[i + 1]; | ||
break; | ||
case '-di': | ||
case '--directory': | ||
program['directory'] = path.resolve(process.cwd(), args[i + 1]); | ||
break; | ||
} | ||
}); | ||
|
||
const { depth=0, all=true } = program; | ||
|
||
(async function() { | ||
const output = await search(process.cwd(), depth); | ||
|
||
Object.keys(output).forEach((repo) => { | ||
const lines = output[repo].split('\n'); | ||
|
||
if(all && lines.length <= 2) { | ||
log(chalk.white.underline(repo)); | ||
log(output[repo]); | ||
} else if(lines.length > 2) { | ||
log(chalk.white.underline(repo)); | ||
lines.forEach((value, index) => { | ||
if(index == 0) { | ||
return log(chalk.white(value)); | ||
} else { | ||
// 'M' -> 'modified' | ||
// 'A ' -> 'added' | ||
// 'D' -> 'deleted' | ||
// 'R' -> 'renamed' | ||
// 'C' -> 'copied' | ||
// '??' -> 'untracked' | ||
|
||
switch(value.substring(0, 2).trim()) { | ||
case 'M': | ||
return log(chalk.red(value)); | ||
case 'A': | ||
return log(chalk.green(value)); | ||
case 'C': | ||
return log(chalk.yellow(value)); | ||
case 'R': | ||
return log(chalk.magenta(value)); | ||
case 'D': | ||
return log(chalk.bgRed.white(value)); | ||
case '??': | ||
return log(chalk.gray(value)); | ||
default: | ||
return log(chalk.white(value)); | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
}()); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.