cli-github 1.8.18 → 1.8.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +11 -119
- package/lib/api/login.js +27 -24
- package/lib/api/profile.js +14 -21
- package/lib/api/stream.js +26 -31
- package/lib/api/user-issues.js +12 -17
- package/lib/api/user-list.js +11 -12
- package/lib/conf/index.js +16 -16
- package/lib/frame-handlers.js +65 -78
- package/lib/ui/profile.js +41 -52
- package/lib/ui/splash-screen.js +27 -32
- package/lib/ui/stream.js +93 -86
- package/lib/ui/user-issues.js +51 -41
- package/lib/ui/user-list.js +50 -41
- package/lib/utils.js +6 -8
- package/package.json +2 -1
package/lib/ui/user-issues.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
// Dependencies
|
|
4
|
-
var Config = require("../conf")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var Config = require("../conf")
|
|
3
|
+
, Table = require("le-table")
|
|
4
|
+
, ImageToAscii = require("image-to-ascii")
|
|
5
|
+
, Overlap = require("overlap")
|
|
6
|
+
, UserIssues = require("../api/user-issues")
|
|
7
|
+
, Utils = require(Config.root + "/lib/utils")
|
|
8
|
+
;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* UserIssues
|
|
@@ -20,28 +19,27 @@ var Config = require("../conf"),
|
|
|
20
19
|
* @return {undefined}
|
|
21
20
|
*/
|
|
22
21
|
module.exports = function (options, progress, callback) {
|
|
23
|
-
callback = callback || function () {};
|
|
22
|
+
callback = callback || function () { };
|
|
24
23
|
UserIssues(options, progress, function (err, data) {
|
|
25
|
-
if (err) {
|
|
26
|
-
return callback(err);
|
|
27
|
-
}
|
|
24
|
+
if (err) { return callback(err); }
|
|
28
25
|
Config.currentFrame = "user-issues";
|
|
29
26
|
|
|
30
27
|
var userIssues = new Table();
|
|
31
28
|
userIssues.addRow(["#", {
|
|
32
|
-
text: "Repo"
|
|
33
|
-
|
|
29
|
+
text: "Repo"
|
|
30
|
+
, data: {
|
|
34
31
|
hAlign: "center"
|
|
35
32
|
}
|
|
36
33
|
}, "Title", {
|
|
37
|
-
text: "Comments"
|
|
38
|
-
|
|
34
|
+
text: "Comments"
|
|
35
|
+
, data: {
|
|
39
36
|
width: 10
|
|
40
37
|
}
|
|
41
38
|
}]);
|
|
42
39
|
|
|
43
|
-
var offsetTop = 10
|
|
44
|
-
|
|
40
|
+
var offsetTop = 10
|
|
41
|
+
, show = Math.floor((Config.cli.h - offsetTop - 3) / 2) - 1
|
|
42
|
+
;
|
|
45
43
|
|
|
46
44
|
if (show > data.length) {
|
|
47
45
|
show = data.length;
|
|
@@ -51,39 +49,51 @@ module.exports = function (options, progress, callback) {
|
|
|
51
49
|
var cEv = data[i];
|
|
52
50
|
|
|
53
51
|
userIssues.addRow([{
|
|
54
|
-
text: i + 1
|
|
55
|
-
|
|
56
|
-
vAlign: "middle"
|
|
57
|
-
|
|
52
|
+
text: i + 1
|
|
53
|
+
, data: {
|
|
54
|
+
vAlign: "middle"
|
|
55
|
+
, width: 6
|
|
58
56
|
}
|
|
59
57
|
}, {
|
|
60
|
-
text: cEv.url.match(/\/repos\/(.*)\/(.*)\/.*/)[1]
|
|
61
|
-
|
|
62
|
-
hAlign: "center"
|
|
63
|
-
|
|
58
|
+
text: cEv.url.match(/\/repos\/(.*)\/(.*)\/.*/)[1]
|
|
59
|
+
, data: {
|
|
60
|
+
hAlign: "center"
|
|
61
|
+
, vAlign: "middle"
|
|
64
62
|
}
|
|
65
|
-
}, cEv.title
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
}, cEv.title
|
|
64
|
+
, {
|
|
65
|
+
text: cEv.comments.toString()
|
|
66
|
+
, data: {
|
|
68
67
|
width: 10
|
|
69
|
-
|
|
68
|
+
}
|
|
70
69
|
}]);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
var cuserIssues = userIssues.stringify()
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
var cuserIssues = userIssues.stringify()
|
|
73
|
+
, output = Overlap({
|
|
74
|
+
who: Config.background
|
|
75
|
+
, with: cuserIssues
|
|
76
|
+
, where: {
|
|
77
|
+
x: Config.cli.w / 2 - cuserIssues.split("\n")[0].length / 2
|
|
78
|
+
, y: 10
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
;
|
|
82
|
+
|
|
83
|
+
|
|
82
84
|
|
|
83
|
-
output = Utils.overlap(output, [
|
|
85
|
+
output = Utils.overlap(output, [
|
|
86
|
+
Config.title
|
|
87
|
+
, " - - - "
|
|
88
|
+
, Config.description
|
|
89
|
+
, ""
|
|
90
|
+
, "-----------------------------------------------------------------"
|
|
91
|
+
, ["Issues assigned to you.", "Pull requests created by you"][({"issues": 0, "pullrequests": 1})[options.type]] + " (@" + Config.username + ")"
|
|
92
|
+
, "-----------------------------------------------------------------"
|
|
93
|
+
], 2, "center");
|
|
84
94
|
|
|
85
95
|
Config.cli.update.render(output.trim(), true, {
|
|
86
96
|
currentFrame: Config.currentFrame
|
|
87
97
|
});
|
|
88
98
|
});
|
|
89
|
-
};
|
|
99
|
+
};
|
package/lib/ui/user-list.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
// Dependencies
|
|
4
|
-
var Config = require("../conf")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var Config = require("../conf")
|
|
3
|
+
, Table = require("le-table")
|
|
4
|
+
, Overlap = require("overlap")
|
|
5
|
+
, UserList = require("../api/user-list")
|
|
6
|
+
, Utils = require(Config.root + "/lib/utils")
|
|
7
|
+
;
|
|
8
|
+
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* NewsFeed
|
|
@@ -18,32 +18,32 @@ var Config = require("../conf"),
|
|
|
18
18
|
*/
|
|
19
19
|
module.exports = function (options, callback) {
|
|
20
20
|
UserList(options, function (err, data) {
|
|
21
|
-
if (err) {
|
|
22
|
-
return callback(err);
|
|
23
|
-
}
|
|
21
|
+
if (err) { return callback(err); }
|
|
24
22
|
Config.currentFrame = "user-list";
|
|
25
23
|
|
|
26
|
-
var offsetTop = 10
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
var offsetTop = 10
|
|
25
|
+
, show = Math.floor((Config.cli.h - offsetTop - 3) / 2) - 1
|
|
26
|
+
, yLimit = show
|
|
27
|
+
, xLimit = Math.floor(Config.cli.w / 32)
|
|
28
|
+
;
|
|
30
29
|
|
|
31
30
|
if (yLimit > data.length) {
|
|
32
31
|
yLimit = data.length;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
var tables = [];
|
|
36
|
-
outer_loop:
|
|
35
|
+
outer_loop:
|
|
36
|
+
for (var x = 0; x < xLimit; ++x) {
|
|
37
37
|
if (!data[x * yLimit]) {
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
40
40
|
var users = new Table();
|
|
41
41
|
tables.push(users);
|
|
42
42
|
users.addRow(["#", {
|
|
43
|
-
text: "Login"
|
|
44
|
-
|
|
45
|
-
width: 23
|
|
46
|
-
|
|
43
|
+
text: "Login"
|
|
44
|
+
, data: {
|
|
45
|
+
width: 23
|
|
46
|
+
, hAlign: "center"
|
|
47
47
|
}
|
|
48
48
|
}]);
|
|
49
49
|
for (var y = 0; y < yLimit; ++y) {
|
|
@@ -52,13 +52,13 @@ module.exports = function (options, callback) {
|
|
|
52
52
|
break outer_loop;
|
|
53
53
|
}
|
|
54
54
|
users.addRow([{
|
|
55
|
-
text: x * yLimit + y + 1
|
|
56
|
-
|
|
55
|
+
text: x * yLimit + y + 1
|
|
56
|
+
, data: {
|
|
57
57
|
width: 6
|
|
58
58
|
}
|
|
59
59
|
}, {
|
|
60
|
-
text: "@" + cUser.login
|
|
61
|
-
|
|
60
|
+
text: "@" + cUser.login
|
|
61
|
+
, data: {
|
|
62
62
|
width: 23
|
|
63
63
|
}
|
|
64
64
|
}]);
|
|
@@ -72,33 +72,42 @@ module.exports = function (options, callback) {
|
|
|
72
72
|
allTables = tables[0].stringify();
|
|
73
73
|
for (var i = 1; i < tables.length; ++i) {
|
|
74
74
|
allTables = Overlap({
|
|
75
|
-
who: allTables
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
x: i * 29
|
|
79
|
-
|
|
75
|
+
who: allTables
|
|
76
|
+
, with: tables[i].stringify()
|
|
77
|
+
, where: {
|
|
78
|
+
x: i * 29
|
|
79
|
+
, y: 0
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
var output = Overlap({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
who: Config.background
|
|
87
|
+
, with: allTables
|
|
88
|
+
, where: {
|
|
89
|
+
x: Config.cli.w / 2 - allTables.split("\n")[0].length / 2
|
|
90
|
+
, y: 10
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
, desc = {
|
|
94
|
+
followers: "@" + options.user + "'s followers"
|
|
95
|
+
, following: "@" + options.user + "'s following"
|
|
96
|
+
, members: "@" + options.user + "'s members"
|
|
91
97
|
}
|
|
92
|
-
|
|
93
|
-
desc = {
|
|
94
|
-
followers: "@" + options.user + "'s followers",
|
|
95
|
-
following: "@" + options.user + "'s following",
|
|
96
|
-
members: "@" + options.user + "'s members"
|
|
97
|
-
};
|
|
98
|
+
;
|
|
98
99
|
|
|
99
|
-
output = Utils.overlap(output, [
|
|
100
|
+
output = Utils.overlap(output, [
|
|
101
|
+
Config.title
|
|
102
|
+
, " - - - "
|
|
103
|
+
, Config.description
|
|
104
|
+
, ""
|
|
105
|
+
, "-----------------------------------------------------------------"
|
|
106
|
+
, desc[options.type]
|
|
107
|
+
, "-----------------------------------------------------------------"
|
|
108
|
+
], 2, "center");
|
|
100
109
|
Config.cli.update.render(output.trim(), true, {
|
|
101
110
|
currentFrame: Config.currentFrame
|
|
102
111
|
});
|
|
103
112
|
});
|
|
104
|
-
};
|
|
113
|
+
};
|
package/lib/utils.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
var Overlap = require("overlap");
|
|
4
2
|
|
|
5
3
|
exports.overlap = function overlapCenter(background, text, y, x) {
|
|
6
4
|
if (typeof text === "string") {
|
|
7
5
|
return Overlap({
|
|
8
|
-
who: background
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
x: x === "center" ? background.split("\n")[0].length / 2 - text.length / 2 - 1 : x
|
|
12
|
-
|
|
6
|
+
who: background
|
|
7
|
+
, with: text
|
|
8
|
+
, where: {
|
|
9
|
+
x: x === "center" ? background.split("\n")[0].length / 2 - text.length / 2 - 1 : x
|
|
10
|
+
, y: y
|
|
13
11
|
}
|
|
14
12
|
});
|
|
15
13
|
}
|
|
@@ -20,4 +18,4 @@ exports.overlap = function overlapCenter(background, text, y, x) {
|
|
|
20
18
|
}
|
|
21
19
|
return background;
|
|
22
20
|
}
|
|
23
|
-
};
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cli-github",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.20",
|
|
4
4
|
"description": "A fancy GitHub client for command line.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"preferGlobal": "true",
|
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
"menu/",
|
|
234
234
|
"cli.js",
|
|
235
235
|
"index.js",
|
|
236
|
+
"index.d.ts",
|
|
236
237
|
"bloggify.js",
|
|
237
238
|
"bloggify.json",
|
|
238
239
|
"bloggify/"
|