Comparing version 1.3.1 to 1.3.2
#!/usr/bin/env node | ||
/* | ||
* Copyright 2013 Eduardo Lundgren, All Rights Reserved. | ||
* Copyright 2013, All Rights Reserved. | ||
* | ||
@@ -6,0 +6,0 @@ * Code licensed under the BSD License: |
/* | ||
* Copyright 2013 Eduardo Lundgren, All Rights Reserved. | ||
* Copyright 2013, All Rights Reserved. | ||
* | ||
@@ -4,0 +4,0 @@ * Code licensed under the BSD License: |
@@ -34,2 +34,3 @@ /* | ||
'assignee' : String, | ||
'browser' : Boolean, | ||
'close' : Boolean, | ||
@@ -54,2 +55,3 @@ 'comment' : String, | ||
'A': [ '--assignee' ], | ||
'B': [ '--browser' ], | ||
'C': [ '--close' ], | ||
@@ -93,2 +95,6 @@ 'c': [ '--comment' ], | ||
if (options.browser) { | ||
instance.browser(options.user, options.repo, options.number); | ||
} | ||
if (options.close) { | ||
@@ -171,2 +177,6 @@ options.state = Issue.STATE_CLOSED; | ||
Issue.prototype.browser = function(user, repo, number) { | ||
open('http://github.com/' + user + '/' + repo + '/issues/' + number); | ||
}; | ||
Issue.prototype.close = function(opt_callback) { | ||
@@ -173,0 +183,0 @@ var instance = this; |
@@ -41,2 +41,3 @@ /* | ||
'branch' : String, | ||
'browser' : Boolean, | ||
'close' : Boolean, | ||
@@ -63,2 +64,3 @@ 'comment' : String, | ||
'b': [ '--branch' ], | ||
'B': [ '--browser' ], | ||
'C': [ '--close' ], | ||
@@ -117,2 +119,6 @@ 'c': [ '--comment' ], | ||
if (options.browser) { | ||
instance.browser(options.user, options.repo, options.number); | ||
} | ||
if (!options.list) { | ||
@@ -166,3 +172,3 @@ options.branch = options.branch || config.default_branch; | ||
instance.merge(logger.defaultCallback); | ||
instance.merge(); | ||
} | ||
@@ -235,2 +241,6 @@ | ||
PullRequest.prototype.browser = function(user, repo, number) { | ||
open('http://github.com/' + user + '/' + repo + '/pull/' + number); | ||
}; | ||
PullRequest.prototype.close = function(opt_callback) { | ||
@@ -524,3 +534,7 @@ var instance = this, | ||
function(callback) { | ||
instance.close(callback); | ||
instance.close(function(err, data) { | ||
callback(err, data); | ||
logger.defaultCallback( | ||
err, null, logger.compileTemplate('Closed {{link}}', { options: options })); | ||
}); | ||
} | ||
@@ -527,0 +541,0 @@ ]; |
@@ -8,2 +8,4 @@ /* | ||
* @author Henrique Vicente <henriquevicente@gmail.com> | ||
* @author Eduardo Lundgren <eduardo.lundgren@gmail.com> | ||
* @author Zeno Rocha <zno.rocha@gmail.com> | ||
*/ | ||
@@ -31,3 +33,5 @@ | ||
options: { | ||
'browser' : Boolean, | ||
'clone' : Boolean, | ||
'delete' : Boolean, | ||
'description' : String, | ||
@@ -40,3 +44,2 @@ 'detailed' : Boolean, | ||
'new' : String, | ||
'open' : Boolean, | ||
'delete' : String, | ||
@@ -49,7 +52,8 @@ 'private' : Boolean, | ||
shorthands: { | ||
'B': [ '--browser' ], | ||
'c': [ '--clone' ], | ||
'D': [ '--delete' ], | ||
'd': [ '--detailed' ], | ||
'l': [ '--list' ], | ||
'n': [ '--new' ], | ||
'o': [ '--open' ], | ||
'p': [ '--private' ], | ||
@@ -61,3 +65,3 @@ 'r': [ '--repo' ], | ||
payload: function(payload, options) { | ||
options.open = true; | ||
options.browser = true; | ||
} | ||
@@ -80,8 +84,33 @@ }; | ||
if (options.browser) { | ||
instance.browser(options.user, options.repo); | ||
} | ||
if (options.delete) { | ||
logger.logTemplate('{{prefix}} [info] Deleting repo {{greenBright options.loggedUser "/" options.delete}}', { | ||
options: options | ||
}); | ||
prompt.get({ | ||
properties: { | ||
confirmation: { | ||
description: 'Are you sure? This action CANNOT be undone. [y/N]' | ||
} | ||
} | ||
}, function (err, result) { | ||
if (result.confirmation.toLowerCase() === 'y') { | ||
instance.delete(options.loggedUser, options.delete, logger.defaultCallback); | ||
} | ||
else { | ||
logger.info('Not deleted.'); | ||
} | ||
}); | ||
} | ||
if (options.list) { | ||
logger.logTemplate('{{prefix}} [info] Listing {{greenBright options.type}} repos for {{greenBright options.user}}', { | ||
logger.logTemplate('{{prefix}} [info] Listing {{greenBright options.type}} repos for {{greenBright options.loggedUser}}', { | ||
options: options | ||
}); | ||
instance.list(options.user, function(err) { | ||
instance.list(options.loggedUser, function(err) { | ||
logger.defaultCallback(err, null, false); | ||
@@ -121,29 +150,6 @@ }); | ||
} | ||
}; | ||
if (options.delete) { | ||
logger.logTemplate('{{prefix}} [info] Deleting repo {{greenBright options.user "/" options.delete}}', { | ||
options: options | ||
}); | ||
prompt.get({ | ||
properties: { | ||
confirmation: { | ||
description: 'Are you sure? This action CANNOT be undone. [y/N]' | ||
} | ||
} | ||
}, function (err, result) { | ||
if (result.confirmation.toLowerCase() === 'y') { | ||
instance.delete(function(err1) { | ||
logger.defaultCallback(err1, null); | ||
}); | ||
} | ||
else { | ||
logger.info('Not deleted.'); | ||
} | ||
}); | ||
} | ||
if (options.open) { | ||
instance.open(options.user, options.repo); | ||
} | ||
Repo.prototype.browser = function(user, repo) { | ||
open('http://github.com/' + user + '/' + repo); | ||
}; | ||
@@ -223,3 +229,3 @@ | ||
Repo.prototype.delete = function(opt_callback) { | ||
Repo.prototype.delete = function(user, repo, opt_callback) { | ||
var instance = this, | ||
@@ -230,4 +236,4 @@ options = instance.options, | ||
payload = { | ||
user: options.user, | ||
repo: options.delete | ||
user: user, | ||
repo: repo | ||
}; | ||
@@ -238,6 +244,2 @@ | ||
Repo.prototype.open = function(user, repo) { | ||
open('http://github.com/' + user + '/' + repo); | ||
}; | ||
exports.Impl = Repo; |
@@ -28,4 +28,3 @@ /* | ||
'login' : Boolean, | ||
'logout': Boolean, | ||
'remote': String | ||
'logout': Boolean | ||
}, | ||
@@ -46,2 +45,4 @@ shorthands: { | ||
options.user = options.loggedUser; | ||
if (options.login) { | ||
@@ -48,0 +49,0 @@ if (User.hasCredentials()) { |
/* | ||
* Copyright 2013 Eduardo Lundgren, All Rights Reserved. | ||
* Copyright 2013, All Rights Reserved. | ||
* | ||
@@ -4,0 +4,0 @@ * Code licensed under the BSD License: |
/* | ||
* Copyright 2013 Eduardo Lundgren, All Rights Reserved. | ||
* Copyright 2013, All Rights Reserved. | ||
* | ||
@@ -4,0 +4,0 @@ * Code licensed under the BSD License: |
{ | ||
"name": "gh", | ||
"description": "GitHub command line tools.", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"homepage": "http://nodegh.io", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -248,2 +248,19 @@ # 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) | ||
### 8. Open | ||
Option | Usage | Type | ||
--- | --- | --- | ||
`-B`, `--browser` | **Required** | `Boolean` | ||
`-n`, `--number` | **Required** | `Number` | ||
`-u`, `--user` | *Optional* | `String` | ||
`-r`, `--repo` | *Optional* | `String` | ||
#### Examples | ||
* Open GitHub pull request page in the browser. | ||
``` | ||
gh pr 100 --browser | ||
``` | ||
## Notifications | ||
@@ -470,2 +487,19 @@ | ||
### 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 | ||
@@ -482,3 +516,3 @@ ``` | ||
--- | --- | --- | ||
`-o`, `--open` | **Required** | `Boolean` | ||
`-B`, `--browser` | **Required** | `Boolean` | ||
`-u`, `--user` | *Optional* | `String` | ||
@@ -489,3 +523,3 @@ `-r`, `--repo` | *Optional* | `String` | ||
* **Shortcut** for opening the GitHub repository page. | ||
* **Shortcut** for opening the GitHub repository page in the browser. | ||
@@ -496,6 +530,6 @@ ``` | ||
* Open GitHub repository page. | ||
* Open GitHub repository page in the browser. | ||
``` | ||
gh re --open --user eduardolundgren --repo node-gh | ||
gh re --browser --user eduardolundgren --repo node-gh | ||
``` | ||
@@ -562,3 +596,3 @@ | ||
gh re --new foo --init --type private | ||
``` | ||
``` | ||
@@ -569,14 +603,13 @@ ### 4. Delete | ||
--- | --- | --- | ||
`--delete` | **Required** | `String` | ||
`--user` | **Required** | `String` | ||
`-D`, `--delete` | **Required** | `String` | ||
`-u`, `--user` | **Required** | `String` | ||
#### Example | ||
* Delete a repository named vanilla of the logged user | ||
* Delete a repository of the logged user. | ||
``` | ||
gh re --delete vanilla | ||
``` | ||
gh re --delete foo | ||
``` | ||
## User | ||
@@ -682,2 +715,6 @@ | ||
* **v1.3.2** September 9, 2013 | ||
* Add ability to open GitHub website from commands | ||
* Add shortcut for `gh repo --delete` | ||
* Use logged user in `gh user` | ||
* **v1.3.1** September 9, 2013 | ||
@@ -684,0 +721,0 @@ * Fix log on `gh repo --new` |
@@ -0,1 +1,10 @@ | ||
/* | ||
* Copyright 2013, All Rights Reserved. | ||
* | ||
* Code licensed under the BSD License: | ||
* https://github.com/eduardolundgren/blob/master/LICENSE.md | ||
* | ||
* @author Rodrigo Vidal <rodrigovidal777@gmail.com> | ||
*/ | ||
var assert = require("assert"); | ||
@@ -2,0 +11,0 @@ var git = require("../lib/git"); |
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
91442
2022
806