Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
- removes commander
- converts all synchronous activity to async (no more blocking io)
  - increased speed 7% [322.030624ms -> 300.058158ms]
  • Loading branch information
gabrielcsapo committed Dec 18, 2017
1 parent dfff611 commit 636f17d
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 2,133 deletions.
18 changes: 13 additions & 5 deletions .eslintrc
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
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ typings/
.env
test/fixtures/test1
.DS_Store
package-lock.json
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ script:
- npm run coverage
- cat coverage/lcov.info | lcov-server --upload https://lcov-server.gabrielcsapo.com
node_js:
- "6"
- "8"
os:
- linux
Expand Down
12 changes: 12 additions & 0 deletions .tryitoutrc.js
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'
}
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# 1.0.0 (12/18/2017)

- removes commander
- converts all synchronous activity to async (no more blocking io)
- increased speed `7%` [`322.030624ms -> 300.058158ms`]

# 0.3.0 (09/09/2017)

- code cleanup
- code cleanup
- drops support for node@4
- updates license in package.json
- updates `chalk@2.0.1` -> `chalk@2.1.0`
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@
## Installation

```
npm install git-unstaged
npm install git-unstaged -g
```

## Usage

```
Usage: git-unstaged [options]
Options:
Commands:
-h, --help, help Output usage information
-v, --version, version Output the version number
-h, --help output usage information
-V, --version output the version number
-d, --depth [value] the specified depth you want to recursively search for github repos
-a, --all show all git repos and their status
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
```

## Example

```
$git-unstaged --depth=2
$git-unstaged --depth 2
/Users/gabrielcsapo/Documents/espyjs
## wip
Expand All @@ -54,7 +56,7 @@ $git-unstaged --depth=2
> Since git allows the execution of non [builtin](https://github.com/git/git/blob/master/git.c#L528) methods another way to run this command would be
```
$git unstaged --depth=2
$git unstaged --depth 2
/Users/gabrielcsapo/Documents/espyjs
## wip
Expand Down
92 changes: 92 additions & 0 deletions bin/git-unstaged.js
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));
}
}
});
}
});
}());
54 changes: 0 additions & 54 deletions bin/index.js

This file was deleted.

Loading

0 comments on commit 636f17d

Please sign in to comment.