Comparing version 0.1.1 to 0.1.2
@@ -23,2 +23,10 @@ #!/usr/bin/env node | ||
process.stdin.setEncoding('utf8'); | ||
process.stdin.on('data', chunk => { | ||
if (chunk === '\u001b') { | ||
// ESC | ||
process.exit(0); | ||
} | ||
}); | ||
args.option('d', 'Select branches which you want to delete'); | ||
@@ -25,0 +33,0 @@ |
const git = require('simple-git/promise'); | ||
const { white } = require('chalk'); | ||
const getGitBranches = async () => { | ||
const result = await git().branch(); | ||
return result; | ||
}; | ||
exports.checkGit = async () => { | ||
@@ -18,4 +14,11 @@ try { | ||
exports.getBranches = async () => { | ||
const { current, all } = await getGitBranches(); | ||
return all.filter(branch => branch !== current); | ||
const { branches } = await git().branch(); | ||
return Object.keys(branches) | ||
.filter(name => !(branches[name].current || name.startsWith('remotes'))) | ||
.map(name => { | ||
const { commit, label } = branches[name]; | ||
const description = white(`[${commit}] ${label}`); | ||
return { name: `${name} ${description}`, value: name }; | ||
}); | ||
}; | ||
@@ -22,0 +25,0 @@ |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"bin": { | ||
@@ -15,0 +15,0 @@ "sg": "./bin/swagit.js", |
# Swagit | ||
![Swagit](https://i.imgur.com/QBNMDxU.png) | ||
## Usage | ||
Firstly, install the package from [npm](https://npmjs.com/release): | ||
```bash | ||
npm install -g swagit | ||
``` | ||
Of course you can use [Yarn](https://yarnpkg.com/en/) to install it: | ||
```bash | ||
yarn global add swagit | ||
``` | ||
Once that's done, you can run this command inside your project's directory: | ||
```bash | ||
swagit | ||
# shotcut | ||
sg | ||
``` | ||
<img src="https://i.imgur.com/lZE5CG1.gif" width="500"> | ||
### Options | ||
#### `-d` | ||
Open a interactive to select branches which will be delete. | ||
<img src="https://i.imgur.com/8Vk1yqS.gif" width="800"> | ||
## License | ||
MIT © [jigsawye](https://jigsawye.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6404
121
40