Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gh

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

14

bin/gh.js
#!/usr/bin/env node
/*
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
*/
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
*/

@@ -12,0 +12,0 @@ var async = require('async'),

/*
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
*/
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
*/
var fs = require('fs'),
var commander = require('commander'),
fs = require('fs'),
moment = require('moment'),

@@ -36,6 +37,10 @@ github = require('github'),

exports.createAuthorization = function(opt_callback) {
logger.log('node-gh needs authorization to use github api');
logger.log('First we need authorization to use GitHub\'s API');
prompt('type your user: ', function(user) {
prompt('type your password: ', function(password) {
prompt('Type your user: ', function(user) {
commander.password('Type your password: ', function(password) {
if (!user || !password) {
logger.error('Both username and password are required');
}
exports.github.authenticate({

@@ -54,3 +59,3 @@ type: "basic",

if (err) {
logger.error('node-gh could not authenticate');
logger.error('Could not authenticate :(');
}

@@ -60,4 +65,4 @@

exports.writeGlobalConfigCredentials(user, res.token);
logger.success('token saved');
opt_callback = opt_callback && opt_callback();
logger.success('Authentication completed :)');
exports.authorize(opt_callback);
process.exit(0);

@@ -97,4 +102,2 @@ }

if (!fs.existsSync(configPath)) {
logger.warn('config file ' + configPath + ' not found');
logger.info('creating ' + configPath);
fs.writeFileSync(configPath, '{}');

@@ -101,0 +104,0 @@ }

/*
* Copyright 2013 Zeno Rocha, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Zeno Rocha <zno.rocha@gmail.com>
*/
* Copyright 2013 Zeno Rocha, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Zeno Rocha <zno.rocha@gmail.com>
*/

@@ -32,6 +32,3 @@ var base = require('../base'),

base.login();
if (options.world) {
instance.world();
}
instance.world();
};

@@ -38,0 +35,0 @@

/*
* Copyright 2013 Zeno Rocha, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Zeno Rocha <zno.rocha@gmail.com>
*/
* Copyright 2013 Zeno Rocha, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Zeno Rocha <zno.rocha@gmail.com>
*/

@@ -10,0 +10,0 @@ var base = require('../base'),

/*
* Copyright 2013 Zeno Rocha, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Zeno Rocha <zno.rocha@gmail.com>
*/
* Copyright 2013 Zeno Rocha, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Zeno Rocha <zno.rocha@gmail.com>
*/

@@ -22,12 +22,12 @@ var async = require('async'),

options: {
'all' : String,
'all' : String,
'comment': String,
'label': String,
'list': Boolean,
'label' : String,
'list' : Boolean,
'message': String,
'new': Boolean,
'number': Number,
'repo': String,
'title': String,
'user': String
'new' : Boolean,
'number' : Number,
'repo' : String,
'title' : String,
'user' : String
},

@@ -51,3 +51,4 @@ shorthands: {

var instance = this,
options = instance.options;
options = instance.options,
success = false;

@@ -63,4 +64,4 @@ options.user = options.user || base.getUser();

instance.comment(function(err) {
logger.defaultCallback(
err, null, logger.compileTemplate('{{link}}', { options: options }));
success = logger.compileTemplate('{{issueLink}}', { options: options });
logger.defaultCallback(err, null, success);
});

@@ -76,6 +77,7 @@ }

if (issue) {
options.createdIssueNumber = issue.number;
options.number = issue.number;
}
logger.defaultCallback(
err, null, logger.compileTemplate('{{issueLink}}', { options: options }));
success = logger.compileTemplate('{{issueLink}}', { options: options });
logger.defaultCallback(err, null, success);
});

@@ -86,6 +88,18 @@ }

if (options.all) {
instance.listFromAllRepositories();
logger.logTemplate('{{prefix}} [info] Listing issues for {{greenBright options.user}}', {
options: options
});
instance.listFromAllRepositories(function(err) {
logger.defaultCallback(err, null, success);
});
}
else {
instance.list(options.repo);
logger.logTemplate('{{prefix}} [info] Listing issues on {{greenBright options.user "/" options.repo}}', {
options: options
});
instance.list(options.repo, function(err) {
logger.defaultCallback(err, null, success);
});
}

@@ -112,11 +126,13 @@ }

Issue.prototype.list = function(repo) {
Issue.prototype.list = function(repo, opt_callback) {
var instance = this,
options = instance.options;
options = instance.options,
payload;
base.github.issues.repoIssues({
payload = {
user: options.user,
repo: repo
},
function(err, issues) {
};
base.github.issues.repoIssues(payload, function(err, issues) {
if (err && !options.all) {

@@ -132,2 +148,4 @@ logger.error(logger.getErrorMessage(err));

});
opt_callback && opt_callback(err);
}

@@ -137,11 +155,13 @@ });

Issue.prototype.listFromAllRepositories = function() {
var instance = this;
Issue.prototype.listFromAllRepositories = function(opt_callback) {
var instance = this,
payload;
base.github.repos.getAll({
payload = {
type: 'all'
},
function(err, repositories) {
};
base.github.repos.getAll(payload, function(err, repositories) {
repositories.forEach(function(repository) {
instance.list(repository.name);
instance.list(repository.name, opt_callback);
});

@@ -148,0 +168,0 @@ });

/*
* Copyright 2013 Zeno Rocha, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Zeno Rocha <zno.rocha@gmail.com>
*/
* Copyright 2013 Zeno Rocha, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Zeno Rocha <zno.rocha@gmail.com>
*/

@@ -45,2 +45,6 @@ var async = require('async'),

if (options.latest) {
logger.logTemplate('{{prefix}} [info] Listing activities on {{greenBright options.user "/" options.repo}}', {
options: options
});
instance.latest();

@@ -50,2 +54,6 @@ }

if (options.watch) {
logger.logTemplate('{{prefix}} [info] Watching any activity on {{greenBright options.user "/" options.repo}}', {
options: options
});
instance.watch();

@@ -106,2 +114,4 @@ }

}
logger.defaultCallback(err, null, false);
});

@@ -108,0 +118,0 @@ };

/*
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
*/
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
*/

@@ -29,18 +29,19 @@ var async = require('async'),

options: {
'all': Boolean,
'branch': String,
'close': Boolean,
'comment': String,
'all' : Boolean,
'branch' : String,
'close' : Boolean,
'comment' : String,
'detailed': Boolean,
'fetch': Boolean,
'fwd': String,
'list': Boolean,
'merge': Boolean,
'number': Number,
'open': Boolean,
'rebase': Boolean,
'repo': String,
'state': [ 'open', 'closed' ],
'submit': String,
'user': String
'fetch' : Boolean,
'fwd' : String,
'list' : Boolean,
'merge' : Boolean,
'number' : Number,
'open' : Boolean,
'rebase' : Boolean,
'repo' : String,
'state' : [ 'open', 'closed' ],
'submit' : String,
'title' : String,
'user' : String
},

@@ -62,2 +63,3 @@ shorthands: {

's': [ '--submit' ],
't': [ '--title' ],
'u': [ '--user' ]

@@ -167,6 +169,18 @@ },

if (options.all) {
instance.listFromAllRepositories();
logger.logTemplate('{{prefix}} [info] Listing pull requests for {{greenBright options.user}}', {
options: options
});
instance.listFromAllRepositories(function(err) {
logger.defaultCallback(err, null, false);
});
}
else {
instance.list(options.repo);
logger.logTemplate('{{prefix}} [info] Listing pull requests on {{greenBright options.user "/" options.repo}}', {
options: options
});
instance.list(options.repo, function(err) {
logger.defaultCallback(err, null, false);
});
}

@@ -424,6 +438,2 @@ }

pulls = data;
if (!pulls.length) {
err = 1;
}
}

@@ -444,3 +454,3 @@ callback(err);

async.series(operations, function(err) {
if (!err) {
if (!err && pulls.length) {
json.repo = repo;

@@ -513,3 +523,3 @@ json.user = options.user;

repo: options.repo,
title: instance.currentBranch,
title: options.title || instance.currentBranch,
user: user

@@ -516,0 +526,0 @@ }, callback);

/*
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
*/
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
*/

@@ -10,0 +10,0 @@ var base = require('./base'),

/*
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
* @author Zeno Rocha <zno.rocha@gmail.com>
*/
* Copyright 2013 Eduardo Lundgren, All Rights Reserved.
*
* Code licensed under the BSD License:
* https://github.com/eduardolundgren/blob/master/LICENSE.md
*
* @author Eduardo Lundgren <eduardolundgren@gmail.com>
* @author Zeno Rocha <zno.rocha@gmail.com>
*/

@@ -50,3 +50,6 @@ var base = require('./base'),

}
logger.success(success || '✔');
if (success !== false) {
logger.success(success || '✔');
}
};

@@ -112,3 +115,3 @@

handlebars.registerHelper('issueLink', function() {
return 'http://github.com/' + this.options.user + "/" + this.options.repo + "/issues/" + this.options.createdIssueNumber;
return 'http://github.com/' + this.options.user + "/" + this.options.repo + "/issues/" + this.options.number;
});

@@ -115,0 +118,0 @@

{
"name": "gh",
"description": "Github command line tools helps you improve using git and github from the terminal.",
"version": "0.1.5",
"version": "0.1.6",
"author": {

@@ -36,6 +36,7 @@ "name": "Eduardo Lundgren",

"cli-prompt": "0.1.0",
"commander": "1.1.1",
"moment ": "2.0.0",
"handlebars ": "1.0.11",
"git-wrapper": "0.1.1",
"github": "0.1.8",
"github": "https://github.com/zenorocha/node-github/tarball/master",
"nopt": "2.1.1"

@@ -42,0 +43,0 @@ },

@@ -31,7 +31,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)

--- | --- | ---
`--list`, `-l` | **Required** | `Boolean`
`--all`, `-a` | *Optional* | `Boolean`
`--branch`, `-b` | *Optional* | `String`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-s` | *Optional* | `String`
`-l`, `--list` | **Required** | `Boolean`
`-a`, `--all` | *Optional* | `Boolean`
`-b`, `--branch` | *Optional* | `String`
`-r`, `--repo` | *Optional* | `String`
`-s`, `--user` | *Optional* | `String`

@@ -62,8 +62,8 @@ #### Examples

--- | --- | ---
`--fetch`, `-f` | **Required** | `Boolean`
`--number`, `-n` | **Required** | `Number`
`--merge`, `-M` | *Optional* | `Boolean`
`--rebase`, `-R` | *Optional* | `Boolean`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-s` | *Optional* | `String`
`-f`, `--fetch` | **Required** | `Boolean`
`-n`, `--number` | **Required** | `Number`
`-M`, `--merge` | *Optional* | `Boolean`
`-R`, `--rebase` | *Optional* | `Boolean`
`-r`, `--repo` | *Optional* | `String`
`-s`, `--user` | *Optional* | `String`

@@ -91,8 +91,8 @@ #### Examples

--- | --- | ---
`--merge`, `-M` | **Required** | `Boolean`
`--rebase`, `-R` | **Required** | `Boolean`
`--number`, `-n` | *Optional* | `Number`
`--branch`, `-b` | *Optional* | `String`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-s` | *Optional* | `String`
`-M`, `--merge` | **Required** | `Boolean`
`-R`, `--rebase` | **Required** | `Boolean`
`-n`, `--number` | *Optional* | `Number`
`-b`, `--branch` | *Optional* | `String`
`-r`, `--repo` | *Optional* | `String`
`-s`, `--user` | *Optional* | `String`

@@ -117,6 +117,6 @@ 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.defaultbranch`.

--- | --- | ---
`--comment`, `-c`| **Required** | `String`
`--number`, `-n` | **Required** | `Number`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-s` | *Optional* | `String`
`-c`, `--comment`| **Required** | `String`
`-n`, `--number` | **Required** | `Number`
`-r`, `--repo` | *Optional* | `String`
`-s`, `--user` | *Optional* | `String`

@@ -136,3 +136,3 @@ #### Examples

`--fwd` | **Required** | `String`
`--number`, `-n` | **Required** | `Number`
`-n`, `--number` | **Required** | `Number`

@@ -151,7 +151,7 @@ #### Examples

--- | --- | ---
`--open`, `-o` | **Required** | `Boolean`
`--close`, `-C` | **Required** | `Boolean`
`--number`, `-n` | **Required** | `Number`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-s` | *Optional* | `String`
`-o`, `--open` | **Required** | `Boolean`
`-C`, `--close` | **Required** | `Boolean`
`-n`, `--number` | **Required** | `Number`
`-r`, `--repo` | *Optional* | `String`
`-s`, `--user` | *Optional* | `String`

@@ -181,5 +181,8 @@ #### Examples

--- | --- | ---
`--submit`, `-s` | **Required** | `String`
`--branch`, `-b` | *Optional* | `String`
`-s`, `--submit` | **Required** | `String`
`-b`, `--branch` | *Optional* | `String`
`-t`, `--title` | *Optional* | `String`
Omitting `--title` will submit a pull request using current branch name as title.
#### Examples

@@ -190,3 +193,3 @@

```
gh pr --submit eduardolundgren
gh pr --submit eduardolundgren --title 'Fix #32'
```

@@ -206,5 +209,5 @@

--- | --- | ---
`--latest`, `-l` | **Required** | `Boolean`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-s` | *Optional* | `String`
`-l`, `--latest` | **Required** | `Boolean`
`-r`, `--repo` | *Optional* | `String`
`-s`, `--user` | *Optional* | `String`

@@ -229,5 +232,5 @@ #### Examples

--- | --- | ---
`--watch`, `-w` | **Required** | `Boolean`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-s` | *Optional* | `String`
`-w`, `--watch` | **Required** | `Boolean`
`-r`, `--repo` | *Optional* | `String`
`-s`, `--user` | *Optional* | `String`

@@ -254,8 +257,8 @@ #### Examples

--- | --- | ---
`--new`, `-N` | **Required** | `Boolean`
`--title`, `-t` | **Required** | `String`
`--label`, `-L` | *Optional* | `String`
`--message`, `-m` | *Optional* | `String`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-u` | *Optional* | `String`
`-N`, `--new` | **Required** | `Boolean`
`-t`, `--title` | **Required** | `String`
`-L`, `--label` | *Optional* | `String`
`-m`, `--message` | *Optional* | `String`
`-r`, `--repo` | *Optional* | `String`
`-u`, `--user` | *Optional* | `String`

@@ -286,6 +289,6 @@ #### Examples

--- | --- | ---
`--comment`, `-c` | **Required** | `String`
`--number`, `-n` | **Required** | `Number`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-u` | *Optional* | `String`
`-c`, `--comment` | **Required** | `String`
`-n`, `--number` | **Required** | `Number`
`-r`, `--repo` | *Optional* | `String`
`-u`, `--user` | *Optional* | `String`

@@ -310,6 +313,6 @@ #### Examples

--- | --- | ---
`--list`, `-l` | **Required** | `Boolean`
`--all`, `-a` | *Optional* | `String`
`--repo`, `-r` | *Optional* | `String`
`--user`, `-u` | *Optional* | `String`
`-l`, `--list` | **Required** | `Boolean`
`-a`, `--all` | *Optional* | `String`
`-r`, `--repo` | *Optional* | `String`
`-u`, `--user` | *Optional* | `String`

@@ -348,2 +351,8 @@ #### Examples

* **v0.1.6** May 30, 2013
* Add the hability to specify a title on `gh pr --submit`
* Add password mask on authentication
* Bug fixes
* **v0.1.5** May 29, 2013
* Fix pull request integrity check
* **v0.1.4** May 28, 2013

@@ -350,0 +359,0 @@ * Add the hability to create an Issue

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc