Comparing version 1.2.2 to 1.3.0
@@ -14,2 +14,4 @@ { | ||
"open_repo_in_browser": true, | ||
"pull_branch_name_prefix": "pull-", | ||
@@ -16,0 +18,0 @@ |
@@ -94,3 +94,3 @@ #!/usr/bin/env node | ||
else { | ||
options.user = options.paramUser || options.remoteUser; | ||
options.user = options.paramUser || options.remoteUser || options.loggedUser; | ||
} | ||
@@ -111,2 +111,4 @@ } | ||
operations.push(User.login); | ||
operations.push(function(callback) { | ||
@@ -122,9 +124,8 @@ git.getUser(options.remote, callback); | ||
operations.push(base.checkVersion); | ||
operations.push(User.login); | ||
async.series(operations, function(err, results) { | ||
options.repo = options.repo || results[1]; | ||
options.currentBranch = options.currentBranch || results[2]; | ||
options.repo = options.repo || results[2]; | ||
options.currentBranch = options.currentBranch || results[3]; | ||
normalizeUser(options, options.user, results[0], base.getUser()); | ||
normalizeUser(options, options.user, results[1], base.getUser()); | ||
@@ -131,0 +132,0 @@ expandAlias(options); |
@@ -33,2 +33,3 @@ /* | ||
'all' : Boolean, | ||
'assignee' : String, | ||
'close' : Boolean, | ||
@@ -52,2 +53,3 @@ 'comment' : String, | ||
'a': [ '--all' ], | ||
'A': [ '--assignee' ], | ||
'C': [ '--close' ], | ||
@@ -203,4 +205,6 @@ 'c': [ '--comment' ], | ||
options.label = options.label || []; | ||
payload = { | ||
labels: options.label = options.label || [], | ||
labels: options.label, | ||
number: options.number, | ||
@@ -233,2 +237,3 @@ repo: options.repo, | ||
options = instance.options, | ||
operations, | ||
payload; | ||
@@ -247,3 +252,20 @@ | ||
base.github.issues.repoIssues(payload, function(err, issues) { | ||
if (options.assignee) { | ||
payload.assignee = options.assignee; | ||
} | ||
operations = [ | ||
function(callback) { | ||
base.github.issues.repoIssues(payload, callback); | ||
} | ||
]; | ||
if (options.milestone === 'none') { | ||
operations.push(function(callback) { | ||
payload.milestone = '*'; | ||
base.github.issues.repoIssues(payload, callback); | ||
}); | ||
} | ||
async.parallel(operations, function(err, results) { | ||
if (err && !options.all) { | ||
@@ -253,2 +275,14 @@ logger.error(logger.getErrorMessage(err)); | ||
var issues = []; | ||
results.forEach(function(result) { | ||
if (result) { | ||
issues = issues.concat(result); | ||
} | ||
}); | ||
issues.sort(function(a, b) { | ||
return a.number > b.number ? -1 : 1; | ||
}); | ||
if (issues && issues.length > 0) { | ||
@@ -305,2 +339,3 @@ logger.logTemplateFile('issue.handlebars', { | ||
payload = { | ||
assignee: options.assignee, | ||
body: options.message, | ||
@@ -307,0 +342,0 @@ repo: options.repo, |
@@ -544,2 +544,3 @@ /* | ||
operations, | ||
title, | ||
pullBranch; | ||
@@ -554,2 +555,8 @@ | ||
function(callback) { | ||
git.getLastCommitMessage(function (err, data) { | ||
title = data; | ||
callback(err); | ||
}); | ||
}, | ||
function(callback) { | ||
base.github.pullRequests.create({ | ||
@@ -560,3 +567,3 @@ base: options.branch, | ||
repo: options.repo, | ||
title: options.title || pullBranch, | ||
title: options.title || title, | ||
user: user | ||
@@ -572,3 +579,3 @@ }, callback); | ||
else { | ||
opt_callback && opt_callback(err, results[1]); | ||
opt_callback && opt_callback(err, results[2]); | ||
} | ||
@@ -575,0 +582,0 @@ }); |
@@ -32,2 +32,8 @@ /* | ||
exports.clone = function(url, folder, opt_callback) { | ||
exports.exec('clone', [url, folder], function(err, data) { | ||
opt_callback(err, data.trim()); | ||
}); | ||
}; | ||
exports.exec = function() { | ||
@@ -64,2 +70,8 @@ var args; | ||
exports.getLastCommitMessage = function(opt_callback) { | ||
exports.exec('log', ['-1', '--pretty=%B', '--no-merges'], function(err, data) { | ||
opt_callback(err, data.trim()); | ||
}); | ||
}; | ||
exports.getRemoteUrl = function(remote, opt_callback) { | ||
@@ -66,0 +78,0 @@ exports.getConfig('remote.' + remote + '.url', opt_callback); |
@@ -114,2 +114,6 @@ /* | ||
handlebars.registerHelper('repoLink', function() { | ||
return 'http://github.com/' + this.options.user + '/' + this.options.repo; | ||
}); | ||
handlebars.registerHelper('wordwrap', function(text, padding, stripNewLines) { | ||
@@ -116,0 +120,0 @@ var gutter = ''; |
{ | ||
"name": "gh", | ||
"description": "GitHub command line tools.", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"homepage": "http://nodegh.io", | ||
@@ -6,0 +6,0 @@ "author": { |
171
README.md
@@ -65,7 +65,7 @@ # Node GH [![Build Status](https://secure.travis-ci.org/eduardolundgren/node-gh.png?branch=master)](https://travis-ci.org/eduardolundgren/node-gh) [![NPM version](https://badge.fury.io/js/gh.png)](http://badge.fury.io/js/gh) | ||
`-S`, `--state` | *Optional* | [`open`, `closed`] | ||
`-s`, `--user` | *Optional* | `String` | ||
`-u`, `--user` | *Optional* | `String` | ||
#### Examples | ||
* List open pulls requests for the current branch. | ||
* **Shortcut** for listing open pulls requests for the current branch. | ||
@@ -104,7 +104,7 @@ ``` | ||
`-r`, `--repo` | *Optional* | `String` | ||
`-s`, `--user` | *Optional* | `String` | ||
`-u`, `--user` | *Optional* | `String` | ||
#### Examples | ||
* Fetch pull request and checkout into a new branch `pull-1`. | ||
* **Shortcut** for fetching pull request and checkout into a new branch `pull-1`. | ||
@@ -134,3 +134,3 @@ ``` | ||
`-r`, `--repo` | *Optional* | `String` | ||
`-s`, `--user` | *Optional* | `String` | ||
`-u`, `--user` | *Optional* | `String` | ||
@@ -144,7 +144,7 @@ Omitting `--number` will try to guess the pull number from branch name e.g. `pull-1` results in `--number 1`. Omitting `--branch` will merge or rebase into `config.default_branch`. | ||
``` | ||
gh pr 1 --merge | ||
gh pr 1 --fetch --merge | ||
``` | ||
``` | ||
gh pr 1 --rebase | ||
gh pr 1 --fetch --rebase | ||
``` | ||
@@ -155,7 +155,7 @@ | ||
``` | ||
gh pr 1 --rebase --branch dev | ||
gh pr 1 --fetch --rebase --branch dev | ||
``` | ||
``` | ||
gh pr 1 --merge --branch dev | ||
gh pr 1 --fetch --merge --branch dev | ||
``` | ||
@@ -171,3 +171,3 @@ | ||
`-r`, `--repo` | *Optional* | `String` | ||
`-s`, `--user` | *Optional* | `String` | ||
`-u`, `--user` | *Optional* | `String` | ||
@@ -206,3 +206,3 @@ #### Examples | ||
`-r`, `--repo` | *Optional* | `String` | ||
`-s`, `--user` | *Optional* | `String` | ||
`-u`, `--user` | *Optional* | `String` | ||
@@ -238,3 +238,3 @@ #### Examples | ||
Omitting `--title` will submit a pull request using current branch name as title. | ||
Omitting `--title` will submit a pull request using the last commit message as title. | ||
@@ -271,7 +271,7 @@ #### Examples | ||
`-r`, `--repo` | *Optional* | `String` | ||
`-s`, `--user` | *Optional* | `String` | ||
`-u`, `--user` | *Optional* | `String` | ||
#### Examples | ||
* Display the latest activities on the current repository. | ||
* **Shortcut** for displaying the latest activities on the current repository. | ||
@@ -295,3 +295,3 @@ ``` | ||
`-r`, `--repo` | *Optional* | `String` | ||
`-s`, `--user` | *Optional* | `String` | ||
`-u`, `--user` | *Optional* | `String` | ||
@@ -326,2 +326,3 @@ #### Examples | ||
`-t`, `--title` | **Required** | `String` | ||
`-A`, `--assignee`| *Optional* | `String` | ||
`-L`, `--label` | *Optional* | `String` | ||
@@ -335,3 +336,3 @@ `-m`, `--message` | *Optional* | `String` | ||
* Create a new issue on the current repository. | ||
* **Shortcut** for creating a new issue on the current repository. | ||
@@ -354,2 +355,8 @@ ``` | ||
* Create a new issue and assign it to someone. | ||
``` | ||
gh is --new --title 'Node GH rocks!' --assignee zenorocha | ||
``` | ||
### 2. Comment | ||
@@ -388,3 +395,3 @@ | ||
`-r`, `--repo` | *Optional* | `String` | ||
`-s`, `--user` | *Optional* | `String` | ||
`-u`, `--user` | *Optional* | `String` | ||
@@ -416,2 +423,3 @@ #### Examples | ||
`-a`, `--all` | *Optional* | `Boolean` | ||
`-A`, `--assignee` | *Optional* | `String` | ||
`-d`, `--detailed` | *Optional* | `Boolean` | ||
@@ -427,3 +435,3 @@ `-L`, `--label` | *Optional* | `String` | ||
* List all issues on the current repository. | ||
* **Shortcut** for listing all issues on the current repository. | ||
@@ -440,2 +448,8 @@ ``` | ||
* List issues assigned to someone. | ||
``` | ||
gh is --list --assignee zenorocha | ||
``` | ||
* List issues with link and content. | ||
@@ -471,2 +485,92 @@ | ||
## Repo | ||
``` | ||
gh repo | ||
``` | ||
> **Alias:** `gh re` | ||
### 1. Open | ||
Option | Usage | Type | ||
--- | --- | --- | ||
`-o`, `--open` | **Required** | `Boolean` | ||
`-u`, `--user` | *Optional* | `String` | ||
`-r`, `--repo` | *Optional* | `String` | ||
#### Examples | ||
* **Shortcut** for opening the GitHub repository page. | ||
``` | ||
gh re | ||
``` | ||
* Open GitHub repository page. | ||
``` | ||
gh re --open --user eduardolundgren --repo node-gh | ||
``` | ||
### 2. List | ||
Option | Usage | Type | ||
--- | --- | --- | ||
`-l`, `--list` | **Required** | `Boolean` | ||
`-d`, `--detailed` | *Optional* | `Boolean` | ||
`-u`, `--user` | *Optional* | `String` | ||
`-t`, `--type` | *Optional* | [`all`, `owner`, `public`, `private`, `member`] | ||
#### Examples | ||
* List all repositories. | ||
``` | ||
gh re --list | ||
``` | ||
* List all private repositories. | ||
``` | ||
gh re --list --type private | ||
``` | ||
* List all repositories for someone. | ||
``` | ||
gh re --list --user zenorocha | ||
``` | ||
### 3. Create | ||
Option | Usage | Type | ||
--- | --- | --- | ||
`-n`, `--new` | **Required** | `String` | ||
`-c`, `--clone` | *Optional* | `Boolean` | ||
`-t`, `--type` | *Optional* | [`private`] | ||
`--init` | *Optional* | `Boolean` | ||
`--gitignore` | *Optional* | `String` | ||
`--homepage` | *Optional* | `String` | ||
`--description` | *Optional* | `String` | ||
#### Examples | ||
* Create a new GitHub repository and clone on the current directory. | ||
``` | ||
gh re --new foo --clone | ||
``` | ||
* Create a new GitHub repository using .gitignore template for Ruby. | ||
``` | ||
gh re --new gemified --gitignore Ruby | ||
``` | ||
* Create a new private repository on GitHub, initializing it with a initial commit of the README. | ||
``` | ||
gh re --new foo --init --type private | ||
``` | ||
## User | ||
@@ -509,6 +613,26 @@ | ||
### 1. Add | ||
### 1. List | ||
Option | Usage | Type | ||
--- | --- | --- | ||
`-l`, `--list` | **Required** | `Boolean` | ||
#### Examples | ||
* **Shortcut** for listing aliases. | ||
``` | ||
gh alias | ||
``` | ||
* List aliases. | ||
``` | ||
gh alias --list | ||
``` | ||
### 2. Add | ||
Option | Usage | Type | ||
--- | --- | --- | ||
`-a`, `--add` | **Required** | `String` | ||
@@ -525,3 +649,3 @@ `-u`, `--user` | **Required** | `String` | ||
### 2. Remove | ||
### 3. Remove | ||
@@ -554,2 +678,9 @@ Option | Usage | Type | ||
* **v1.3.0** September 8, 2013 | ||
* Add new `gh repo` command | ||
* Authenticate with GitHub regardless the command is run from a git repo | ||
* Use last commit message as pull request title instead of branch name | ||
* Document `gh alias --list` | ||
* Add `--assignee` flag for issues | ||
* Fix list issues that are related to a milestone | ||
* **v1.2.2** August 14, 2013 | ||
@@ -556,0 +687,0 @@ * Include `--description` attribute on PR submit |
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
88386
29
1957
749