Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
Issue cmd: Add --browser flag
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorocha committed Sep 10, 2013
1 parent fd35bd4 commit 69ac1a7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,23 @@ gh is --list --label todo,bug
gh is --list --user eduardolundgren --repo node-gh
```
### 5. Open
Option | Usage | Type
--- | --- | ---
`-B`, `--browser` | **Required** | `Boolean`
`-n`, `--number` | **Required** | `Number`
`-u`, `--user` | *Optional* | `String`
`-r`, `--repo` | *Optional* | `String`
#### Examples
* Open GitHub issue page in the browser.
```
gh is 100 --browser
```
## Repo
```
gh repo
Expand Down
10 changes: 10 additions & 0 deletions lib/cmds/issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Issue.DETAILS = {
options: {
'all' : Boolean,
'assignee' : String,
'browser' : Boolean,
'close' : Boolean,
'comment' : String,
'detailed' : Boolean,
Expand All @@ -50,6 +51,7 @@ Issue.DETAILS = {
shorthands: {
'a': [ '--all' ],
'A': [ '--assignee' ],
'B': [ '--browser' ],
'C': [ '--close' ],
'c': [ '--comment' ],
'd': [ '--detailed' ],
Expand Down Expand Up @@ -88,6 +90,10 @@ Issue.prototype.run = function() {

options.state = options.state || Issue.STATE_OPEN;

if (options.browser) {
instance.browser(options.user, options.repo, options.number);
}

if (options.close) {
options.state = Issue.STATE_CLOSED;

Expand Down Expand Up @@ -165,6 +171,10 @@ Issue.prototype.run = function() {

};

Issue.prototype.browser = function(user, repo, number) {
open('http://github.com/' + user + '/' + repo + '/issues/' + number);
};

Issue.prototype.close = function(opt_callback) {
var instance = this;

Expand Down

0 comments on commit 69ac1a7

Please sign in to comment.