From a180bc14316f23f9ab0b3268d4d647a653de7013 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 28 Oct 2017 17:29:10 -0400 Subject: [PATCH 1/2] add cli flag for alternate hosts allows ent github/alternate urls --- bin/github-stats | 6 ++++-- lib/index.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/github-stats b/bin/github-stats index c261d0a..3fd7528 100755 --- a/bin/github-stats +++ b/bin/github-stats @@ -16,6 +16,7 @@ var userOption = new Clp.Option(["u", "user"], "The GitHub user to get stats abo , calOption = new Clp.Option(["c", "calendar"], "Show the calendar.") , userStatsOption = new Clp.Option(["us", "user-stats"], "Display user stats.") , repoStatsOption = new Clp.Option(["rs", "repo-stats"], "Display repository stats.") + , altHostOption = new Clp.Option(["ah", "alt-host"], "Alternate Github host.", "host") , parser = new Clp({ name: "GitHub Stats" , version: Package.version @@ -24,13 +25,13 @@ var userOption = new Clp.Option(["u", "user"], "The GitHub user to get stats abo , examples: [ "gh-stats -u IonicaBizau -r gh-stats --us --rs -c # Show everything" , "gh-stats -u IonicaBizau # Show the calendar" - , "gh-stats -r IonicaBizau/git-stats # Repository stats" + , "gh-stats -r IonicaBizau/git-stats --alt-host https://github.myhost.com/api/v3/ # Repository stats from hosted Github" ] , docs_url: "https://github.com/IonicaBizau/gh-stats" }, [ userOption, repoOption, noAnsiOption , lightOption, calOption, userStatsOption - , repoStatsOption, tokenOption + , repoStatsOption, altHostOption, tokenOption ]) , stats = null ; @@ -55,6 +56,7 @@ stats = new GitHubStats({ , s_user: userStatsOption.is_provided , cal: calOption.is_provided , token: tokenOption.value + , host: altHostOption.value }); diff --git a/lib/index.js b/lib/index.js index 02f91f1..5b9cb52 100644 --- a/lib/index.js +++ b/lib/index.js @@ -32,6 +32,8 @@ function GitHubStats(options) { ; this.theme = options.theme; + this.host = options.host; + this.repo = options.repo; this.user = options.user; if (this.repo || this.user) { @@ -78,7 +80,7 @@ GitHubStats.prototype.fromUser = function (callback) { callback(new Error("User is missing.")); return self; } - var stats = new GitHubPolyglot(self.user, self.token); + var stats = new GitHubPolyglot(self.user, self.token, self.host); stats.userStats(callback); return self; }; @@ -104,7 +106,7 @@ GitHubStats.prototype.fromRepo = function (callback) { return self; } - var stats = new GitHubPolyglot([self.user, self.repo].join("/"), self.token); + var stats = new GitHubPolyglot([self.user, self.repo].join("/"), self.token, self.host); stats.repoStats(callback); return self; }; From 832ecdff1a292864730963572b0440649a6d41e8 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 28 Oct 2017 17:37:30 -0400 Subject: [PATCH 2/2] update `contributors` --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 566fd56..7e96f4d 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,9 @@ "calendar" ], "author": "Ionică Bizău (https://ionicabizau.net)", + "contributors": [ + "Evan Baker (github.com/rbtr)" + ], "license": "MIT", "bugs": { "url": "https://github.com/IonicaBizau/github-stats/issues"