@shortcut-cli/shortcut-cli 3.3.0 → 3.5.0
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/README.md +102 -73
- package/build/_virtual/rolldown_runtime.js +25 -0
- package/build/bin/short-api.js +78 -0
- package/build/bin/short-create.js +52 -147
- package/build/bin/short-epics.js +32 -111
- package/build/bin/short-find.js +6 -5
- package/build/bin/short-install.js +38 -128
- package/build/bin/short-members.js +29 -81
- package/build/bin/short-projects.js +29 -84
- package/build/bin/short-search.js +49 -134
- package/build/bin/short-story.js +200 -363
- package/build/bin/short-workflows.js +26 -74
- package/build/bin/short-workspace.js +62 -127
- package/build/bin/short.js +9 -30
- package/build/lib/client.js +12 -8
- package/build/lib/configure.js +95 -105
- package/build/lib/spinner.js +16 -13
- package/build/lib/stories.js +302 -496
- package/build/package.js +18 -0
- package/package.json +30 -28
- package/build/tsconfig.tsbuildinfo +0 -1
package/build/bin/short-epics.js
CHANGED
|
@@ -1,115 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
+
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
|
+
const require_lib_client = require('../lib/client.js');
|
|
5
|
+
const commander = require_rolldown_runtime.__toESM(require("commander"));
|
|
6
|
+
const chalk = require_rolldown_runtime.__toESM(require("chalk"));
|
|
7
|
+
|
|
8
|
+
//#region src/bin/short-epics.ts
|
|
9
|
+
const log = console.log;
|
|
10
|
+
const spin = require_lib_spinner.default();
|
|
11
|
+
const program = commander.default.description("Display epics available for stories").option("-a, --archived", "List only epics including archived", "").option("-c, --completed", "List only epics that have been completed", "").option("-d, --detailed", "List more details for each epic", "").option("-f, --format [template]", "Format each epic output by template", "").option("-M, --milestone [ID]", "List epics in milestone matching id", "").option("-t, --title [query]", "List epics with name/title containing query", "").option("-s, --started", "List epics that have been started", "").parse(process.argv);
|
|
12
|
+
const main = async () => {
|
|
13
|
+
spin.start();
|
|
14
|
+
const epics = await require_lib_client.default.listEpics(null).then((r) => r.data);
|
|
15
|
+
spin.stop(true);
|
|
16
|
+
const textMatch = new RegExp(program.title, "i");
|
|
17
|
+
epics.filter((epic) => {
|
|
18
|
+
return !!`${epic.name} ${epic.name}`.match(textMatch) && !!(program.milestone ? epic.milestone_id == program.milestone : true);
|
|
19
|
+
}).map(printItem);
|
|
11
20
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
-
default:
|
|
27
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
-
if (t[2]) _.ops.pop();
|
|
32
|
-
_.trys.pop(); continue;
|
|
33
|
-
}
|
|
34
|
-
op = body.call(thisArg, _);
|
|
35
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
var client_1 = require("../lib/client");
|
|
41
|
-
var commander = require("commander");
|
|
42
|
-
var chalk_1 = require("chalk");
|
|
43
|
-
var spinner_1 = require("../lib/spinner");
|
|
44
|
-
var log = console.log;
|
|
45
|
-
var spin = (0, spinner_1.default)();
|
|
46
|
-
var program = commander
|
|
47
|
-
.description('Display epics available for stories')
|
|
48
|
-
.option('-a, --archived', 'List only epics including archived', '')
|
|
49
|
-
.option('-c, --completed', 'List only epics that have been completed', '')
|
|
50
|
-
.option('-d, --detailed', 'List more details for each epic', '')
|
|
51
|
-
.option('-f, --format [template]', 'Format each epic output by template', '')
|
|
52
|
-
.option('-M, --milestone [ID]', 'List epics in milestone matching id', '')
|
|
53
|
-
.option('-t, --title [query]', 'List epics with name/title containing query', '')
|
|
54
|
-
.option('-s, --started', 'List epics that have been started', '')
|
|
55
|
-
.parse(process.argv);
|
|
56
|
-
var main = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var epics, textMatch;
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
switch (_a.label) {
|
|
60
|
-
case 0:
|
|
61
|
-
spin.start();
|
|
62
|
-
return [4, client_1.default.listEpics(null).then(function (r) { return r.data; })];
|
|
63
|
-
case 1:
|
|
64
|
-
epics = _a.sent();
|
|
65
|
-
spin.stop(true);
|
|
66
|
-
textMatch = new RegExp(program.title, 'i');
|
|
67
|
-
epics
|
|
68
|
-
.filter(function (epic) {
|
|
69
|
-
return (!!(epic.name + " " + epic.name).match(textMatch) &&
|
|
70
|
-
!!(program.milestone ? epic.milestone_id == program.milestone : true));
|
|
71
|
-
})
|
|
72
|
-
.map(printItem);
|
|
73
|
-
return [2];
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}); };
|
|
77
|
-
var printItem = function (epic) {
|
|
78
|
-
if (epic.archived && !program.archived)
|
|
79
|
-
return;
|
|
80
|
-
if (!epic.started && program.started)
|
|
81
|
-
return;
|
|
82
|
-
if (!epic.completed && program.completed)
|
|
83
|
-
return;
|
|
84
|
-
var defaultFormat = "#%id %t\nMilestone:\t%m\nState:\t\t%s\nDeadline:\t%dl\n";
|
|
85
|
-
defaultFormat += "Points:\t\t%p\nPoints Started: %ps\nPoints Done:\t%pd\nCompletion:\t%c\n";
|
|
86
|
-
if (epic.archived) {
|
|
87
|
-
defaultFormat += "Archived:\t%ar\n";
|
|
88
|
-
}
|
|
89
|
-
if (epic.started) {
|
|
90
|
-
defaultFormat += "Started:\t%st\n";
|
|
91
|
-
}
|
|
92
|
-
if (epic.completed) {
|
|
93
|
-
defaultFormat += "Completed:\t%co\n";
|
|
94
|
-
}
|
|
95
|
-
if (program.detailed) {
|
|
96
|
-
defaultFormat += "Description:\t%d\n";
|
|
97
|
-
}
|
|
98
|
-
var format = program.format || defaultFormat;
|
|
99
|
-
log(format
|
|
100
|
-
.replace(/%id/, chalk_1.default.bold("" + epic.id))
|
|
101
|
-
.replace(/%t/, chalk_1.default.blue("" + epic.name))
|
|
102
|
-
.replace(/%m/, "" + (epic.milestone_id || '_'))
|
|
103
|
-
.replace(/%s/, "" + epic.state)
|
|
104
|
-
.replace(/%dl/, "" + (epic.deadline || '_'))
|
|
105
|
-
.replace(/%d/, "" + epic.description)
|
|
106
|
-
.replace(/%p/, "" + epic.stats.num_points)
|
|
107
|
-
.replace(/%ps/, "" + epic.stats.num_points_started)
|
|
108
|
-
.replace(/%pd/, "" + epic.stats.num_points_done)
|
|
109
|
-
.replace(/%c/, Math.round((epic.stats.num_points_done / (epic.stats.num_points || 1)) * 100) + "%")
|
|
110
|
-
.replace(/%a/, "" + epic.archived)
|
|
111
|
-
.replace(/%st/, "" + epic.started_at)
|
|
112
|
-
.replace(/%co/, "" + epic.completed_at));
|
|
21
|
+
const printItem = (epic) => {
|
|
22
|
+
if (epic.archived && !program.archived) return;
|
|
23
|
+
if (!epic.started && program.started) return;
|
|
24
|
+
if (!epic.completed && program.completed) return;
|
|
25
|
+
let defaultFormat = `#%id %t\nMilestone:\t%m\nState:\t\t%s\nDeadline:\t%dl\n`;
|
|
26
|
+
defaultFormat += `Points:\t\t%p\nPoints Started: %ps\nPoints Done:\t%pd\nCompletion:\t%c\n`;
|
|
27
|
+
if (epic.archived) defaultFormat += `Archived:\t%ar\n`;
|
|
28
|
+
if (epic.started) defaultFormat += `Started:\t%st\n`;
|
|
29
|
+
if (epic.completed) defaultFormat += `Completed:\t%co\n`;
|
|
30
|
+
if (program.detailed) defaultFormat += `Description:\t%d\n`;
|
|
31
|
+
const format = program.format || defaultFormat;
|
|
32
|
+
log(format.replace(/%id/, chalk.default.bold(`${epic.id}`)).replace(/%t/, chalk.default.blue(`${epic.name}`)).replace(/%m/, `${epic.milestone_id || "_"}`).replace(/%s/, `${epic.state}`).replace(/%dl/, `${epic.deadline || "_"}`).replace(/%d/, `${epic.description}`).replace(/%p/, `${epic.stats.num_points}`).replace(/%ps/, `${epic.stats.num_points_started}`).replace(/%pd/, `${epic.stats.num_points_done}`).replace(/%c/, `${Math.round(epic.stats.num_points_done / (epic.stats.num_points || 1) * 100)}%`).replace(/%a/, `${epic.archived}`).replace(/%st/, `${epic.started_at}`).replace(/%co/, `${epic.completed_at}`));
|
|
113
33
|
};
|
|
114
34
|
main();
|
|
115
|
-
|
|
35
|
+
|
|
36
|
+
//#endregion
|
package/build/bin/short-find.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const require_bin_short_search = require('./short-search.js');
|
|
3
|
+
|
|
4
|
+
//#region src/bin/short-find.ts
|
|
5
|
+
require_bin_short_search.main();
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
@@ -1,132 +1,42 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
+
const require_lib_configure = require('../lib/configure.js');
|
|
4
|
+
const require_package = require('../package.js');
|
|
5
|
+
const commander = require_rolldown_runtime.__toESM(require("commander"));
|
|
6
|
+
const __shortcut_client = require_rolldown_runtime.__toESM(require("@shortcut/client"));
|
|
7
|
+
const prompt = require_rolldown_runtime.__toESM(require("prompt"));
|
|
8
|
+
|
|
9
|
+
//#region src/bin/short-install.ts
|
|
10
|
+
const extant = require_lib_configure.loadCachedConfig();
|
|
11
|
+
const log = console.log;
|
|
12
|
+
const program = commander.default.version(require_package.version).description("Install access token and other settings for the Shortcut API").option("-f, --force", "Force install/reinstall").option("-r, --refresh", "Refresh the configuration with details from Shortcut.").parse(process.argv);
|
|
13
|
+
const enrichConfigWithMemberDetails = async (config) => {
|
|
14
|
+
log("Fetching user/member details from Shortcut...");
|
|
15
|
+
const member = await new __shortcut_client.ShortcutClient(config.token).getCurrentMemberInfo().then((r) => r.data);
|
|
16
|
+
return {
|
|
17
|
+
mentionName: member.mention_name,
|
|
18
|
+
urlSlug: member.workspace2.url_slug,
|
|
19
|
+
...config
|
|
20
|
+
};
|
|
13
21
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
const main = async () => {
|
|
23
|
+
if (program.refresh) require_lib_configure.updateConfig(await enrichConfigWithMemberDetails(extant));
|
|
24
|
+
else if (!extant.token || program.force) {
|
|
25
|
+
const schema = { properties: { token: {
|
|
26
|
+
message: "API Token -> https://app.shortcut.com/xxxx/settings/account/api-tokens",
|
|
27
|
+
required: true
|
|
28
|
+
} } };
|
|
29
|
+
prompt.default.start({ message: "Shortcut" });
|
|
30
|
+
prompt.default.get(schema, async (err, result) => {
|
|
31
|
+
if (err) return log(err);
|
|
32
|
+
const config = await enrichConfigWithMemberDetails(result);
|
|
33
|
+
log("Saving config...");
|
|
34
|
+
const success = require_lib_configure.updateConfig(config);
|
|
35
|
+
if (success) log("Saved config");
|
|
36
|
+
else log("Error saving config");
|
|
37
|
+
});
|
|
38
|
+
} else if (extant.token) log("A configuration/token is already saved. To override, re-run with --force");
|
|
22
39
|
};
|
|
23
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
-
function step(op) {
|
|
28
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
-
while (_) try {
|
|
30
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
31
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
-
switch (op[0]) {
|
|
33
|
-
case 0: case 1: t = op; break;
|
|
34
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
-
default:
|
|
38
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
-
if (t[2]) _.ops.pop();
|
|
43
|
-
_.trys.pop(); continue;
|
|
44
|
-
}
|
|
45
|
-
op = body.call(thisArg, _);
|
|
46
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
var prompt = require("prompt");
|
|
52
|
-
var configure_1 = require("../lib/configure");
|
|
53
|
-
var commander = require("commander");
|
|
54
|
-
var client_1 = require("@shortcut/client");
|
|
55
|
-
var extant = (0, configure_1.loadCachedConfig)();
|
|
56
|
-
var log = console.log;
|
|
57
|
-
var program = commander
|
|
58
|
-
.version(require('../../package').version)
|
|
59
|
-
.description('Install access token and other settings for the Shortcut API')
|
|
60
|
-
.option('-f, --force', 'Force install/reinstall')
|
|
61
|
-
.option('-r, --refresh', 'Refresh the configuration with details from Shortcut.')
|
|
62
|
-
.parse(process.argv);
|
|
63
|
-
var enrichConfigWithMemberDetails = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
64
|
-
var member;
|
|
65
|
-
return __generator(this, function (_a) {
|
|
66
|
-
switch (_a.label) {
|
|
67
|
-
case 0:
|
|
68
|
-
log('Fetching user/member details from Shortcut...');
|
|
69
|
-
return [4, new client_1.ShortcutClient(config.token)
|
|
70
|
-
.getCurrentMemberInfo()
|
|
71
|
-
.then(function (r) { return r.data; })];
|
|
72
|
-
case 1:
|
|
73
|
-
member = _a.sent();
|
|
74
|
-
return [2, __assign({ mentionName: member.mention_name, urlSlug: member.workspace2.url_slug }, config)];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}); };
|
|
78
|
-
var main = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
-
var _a, schema;
|
|
80
|
-
return __generator(this, function (_b) {
|
|
81
|
-
switch (_b.label) {
|
|
82
|
-
case 0:
|
|
83
|
-
if (!program.refresh) return [3, 2];
|
|
84
|
-
_a = configure_1.updateConfig;
|
|
85
|
-
return [4, enrichConfigWithMemberDetails(extant)];
|
|
86
|
-
case 1:
|
|
87
|
-
_a.apply(void 0, [_b.sent()]);
|
|
88
|
-
return [3, 3];
|
|
89
|
-
case 2:
|
|
90
|
-
if (!extant.token || program.force) {
|
|
91
|
-
schema = {
|
|
92
|
-
properties: {
|
|
93
|
-
token: {
|
|
94
|
-
message: 'API Token -> https://app.shortcut.com/xxxx/settings/account/api-tokens',
|
|
95
|
-
required: true,
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
prompt.start({ message: 'Shortcut' });
|
|
100
|
-
prompt.get(schema, function (err, result) { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
|
-
var config, success;
|
|
102
|
-
return __generator(this, function (_a) {
|
|
103
|
-
switch (_a.label) {
|
|
104
|
-
case 0:
|
|
105
|
-
if (err)
|
|
106
|
-
return [2, log(err)];
|
|
107
|
-
return [4, enrichConfigWithMemberDetails(result)];
|
|
108
|
-
case 1:
|
|
109
|
-
config = _a.sent();
|
|
110
|
-
log('Saving config...');
|
|
111
|
-
success = (0, configure_1.updateConfig)(config);
|
|
112
|
-
if (success) {
|
|
113
|
-
log('Saved config');
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
log('Error saving config');
|
|
117
|
-
}
|
|
118
|
-
return [2];
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}); });
|
|
122
|
-
}
|
|
123
|
-
else if (extant.token) {
|
|
124
|
-
log('A configuration/token is already saved. To override, re-run with --force');
|
|
125
|
-
}
|
|
126
|
-
_b.label = 3;
|
|
127
|
-
case 3: return [2];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}); };
|
|
131
40
|
main();
|
|
132
|
-
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
@@ -1,85 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
+
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
|
+
const require_lib_client = require('../lib/client.js');
|
|
5
|
+
const commander = require_rolldown_runtime.__toESM(require("commander"));
|
|
6
|
+
const chalk = require_rolldown_runtime.__toESM(require("chalk"));
|
|
7
|
+
|
|
8
|
+
//#region src/bin/short-members.ts
|
|
9
|
+
const spin = require_lib_spinner.default("Loading... %s ");
|
|
10
|
+
const log = console.log;
|
|
11
|
+
const program = commander.default.description("Display members available for stories").option("-s, --search [query]", "List members with name containing query", "").option("-d, --disabled", "List members including disabled", "").parse(process.argv);
|
|
12
|
+
const main = async () => {
|
|
13
|
+
spin.start();
|
|
14
|
+
const members = await require_lib_client.default.listMembers(null).then((r) => r.data);
|
|
15
|
+
spin.stop(true);
|
|
16
|
+
const ownerMatch = new RegExp(program.search, "i");
|
|
17
|
+
members.filter((o) => {
|
|
18
|
+
return !!`${o.profile.name} ${o.profile.mention_name}`.match(ownerMatch);
|
|
19
|
+
}).map(printMember);
|
|
11
20
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
switch (op[0]) {
|
|
22
|
-
case 0: case 1: t = op; break;
|
|
23
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
-
default:
|
|
27
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
-
if (t[2]) _.ops.pop();
|
|
32
|
-
_.trys.pop(); continue;
|
|
33
|
-
}
|
|
34
|
-
op = body.call(thisArg, _);
|
|
35
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
var client_1 = require("../lib/client");
|
|
41
|
-
var spinner_1 = require("../lib/spinner");
|
|
42
|
-
var spin = (0, spinner_1.default)('Loading... %s ');
|
|
43
|
-
var log = console.log;
|
|
44
|
-
var commander = require("commander");
|
|
45
|
-
var chalk_1 = require("chalk");
|
|
46
|
-
var program = commander
|
|
47
|
-
.description('Display members available for stories')
|
|
48
|
-
.option('-s, --search [query]', 'List members with name containing query', '')
|
|
49
|
-
.option('-d, --disabled', 'List members including disabled', '')
|
|
50
|
-
.parse(process.argv);
|
|
51
|
-
var main = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
-
var members, ownerMatch;
|
|
53
|
-
return __generator(this, function (_a) {
|
|
54
|
-
switch (_a.label) {
|
|
55
|
-
case 0:
|
|
56
|
-
spin.start();
|
|
57
|
-
return [4, client_1.default.listMembers(null).then(function (r) { return r.data; })];
|
|
58
|
-
case 1:
|
|
59
|
-
members = _a.sent();
|
|
60
|
-
spin.stop(true);
|
|
61
|
-
ownerMatch = new RegExp(program.search, 'i');
|
|
62
|
-
members
|
|
63
|
-
.filter(function (o) {
|
|
64
|
-
return !!(o.profile.name + " " + o.profile.mention_name).match(ownerMatch);
|
|
65
|
-
})
|
|
66
|
-
.map(printMember);
|
|
67
|
-
return [2];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}); };
|
|
71
|
-
var printMember = function (member) {
|
|
72
|
-
if (member.disabled && !program.disabled)
|
|
73
|
-
return;
|
|
74
|
-
log(chalk_1.default.bold("#" + member.id));
|
|
75
|
-
log(chalk_1.default.bold('Name: ') + (" " + member.profile.name));
|
|
76
|
-
log(chalk_1.default.bold('Mention Name: ') + (" " + member.profile.mention_name));
|
|
77
|
-
log(chalk_1.default.bold('Role: ') + (" " + member.role));
|
|
78
|
-
log(chalk_1.default.bold('Email: ') + (" " + member.profile.email_address));
|
|
79
|
-
if (member.disabled) {
|
|
80
|
-
log(chalk_1.default.bold('Disabled: ') + (" " + member.disabled));
|
|
81
|
-
}
|
|
82
|
-
log();
|
|
21
|
+
const printMember = (member) => {
|
|
22
|
+
if (member.disabled && !program.disabled) return;
|
|
23
|
+
log(chalk.default.bold(`#${member.id}`));
|
|
24
|
+
log(chalk.default.bold("Name: ") + ` ${member.profile.name}`);
|
|
25
|
+
log(chalk.default.bold("Mention Name: ") + ` ${member.profile.mention_name}`);
|
|
26
|
+
log(chalk.default.bold("Role: ") + ` ${member.role}`);
|
|
27
|
+
log(chalk.default.bold("Email: ") + ` ${member.profile.email_address}`);
|
|
28
|
+
if (member.disabled) log(chalk.default.bold("Disabled: ") + ` ${member.disabled}`);
|
|
29
|
+
log();
|
|
83
30
|
};
|
|
84
31
|
main();
|
|
85
|
-
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
@@ -1,88 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
+
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
|
+
const require_lib_client = require('../lib/client.js');
|
|
5
|
+
const commander = require_rolldown_runtime.__toESM(require("commander"));
|
|
6
|
+
const chalk = require_rolldown_runtime.__toESM(require("chalk"));
|
|
7
|
+
|
|
8
|
+
//#region src/bin/short-projects.ts
|
|
9
|
+
const spin = require_lib_spinner.default();
|
|
10
|
+
const log = console.log;
|
|
11
|
+
const program = commander.default.description("Display projects available for stories").option("-a, --archived", "List only projects including archived", "").option("-d, --detailed", "List more details for each project", "").option("-t, --title [query]", "List projects with name/title containing query", "").parse(process.argv);
|
|
12
|
+
const main = async () => {
|
|
13
|
+
spin.start();
|
|
14
|
+
const projects = await require_lib_client.default.listProjects().then((r) => r.data);
|
|
15
|
+
spin.stop(true);
|
|
16
|
+
const textMatch = new RegExp(program.title, "i");
|
|
17
|
+
projects.filter((o) => {
|
|
18
|
+
return !!`${o.name} ${o.name}`.match(textMatch);
|
|
19
|
+
}).map(printItem);
|
|
11
20
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
switch (op[0]) {
|
|
22
|
-
case 0: case 1: t = op; break;
|
|
23
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
-
default:
|
|
27
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
-
if (t[2]) _.ops.pop();
|
|
32
|
-
_.trys.pop(); continue;
|
|
33
|
-
}
|
|
34
|
-
op = body.call(thisArg, _);
|
|
35
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
var client_1 = require("../lib/client");
|
|
41
|
-
var commander = require("commander");
|
|
42
|
-
var chalk_1 = require("chalk");
|
|
43
|
-
var spinner_1 = require("../lib/spinner");
|
|
44
|
-
var spin = (0, spinner_1.default)();
|
|
45
|
-
var log = console.log;
|
|
46
|
-
var program = commander
|
|
47
|
-
.description('Display projects available for stories')
|
|
48
|
-
.option('-a, --archived', 'List only projects including archived', '')
|
|
49
|
-
.option('-d, --detailed', 'List more details for each project', '')
|
|
50
|
-
.option('-t, --title [query]', 'List projects with name/title containing query', '')
|
|
51
|
-
.parse(process.argv);
|
|
52
|
-
var main = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
-
var projects, textMatch;
|
|
54
|
-
return __generator(this, function (_a) {
|
|
55
|
-
switch (_a.label) {
|
|
56
|
-
case 0:
|
|
57
|
-
spin.start();
|
|
58
|
-
return [4, client_1.default.listProjects().then(function (r) { return r.data; })];
|
|
59
|
-
case 1:
|
|
60
|
-
projects = _a.sent();
|
|
61
|
-
spin.stop(true);
|
|
62
|
-
textMatch = new RegExp(program.title, 'i');
|
|
63
|
-
projects
|
|
64
|
-
.filter(function (o) {
|
|
65
|
-
return !!(o.name + " " + o.name).match(textMatch);
|
|
66
|
-
})
|
|
67
|
-
.map(printItem);
|
|
68
|
-
return [2];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}); };
|
|
72
|
-
var printItem = function (proj) {
|
|
73
|
-
if (proj.archived && !program.archived)
|
|
74
|
-
return;
|
|
75
|
-
log(chalk_1.default.bold("#" + proj.id) + chalk_1.default.blue(" " + proj.name));
|
|
76
|
-
log(chalk_1.default.bold('Points: ') + (" " + proj.stats.num_points));
|
|
77
|
-
log(chalk_1.default.bold('Stories: ') + (" " + proj.stats.num_stories));
|
|
78
|
-
log(chalk_1.default.bold('Started: ') + (" " + proj.start_time));
|
|
79
|
-
if (proj.archived) {
|
|
80
|
-
log(chalk_1.default.bold('Archived: ') + (" " + proj.archived));
|
|
81
|
-
}
|
|
82
|
-
if (program.detailed) {
|
|
83
|
-
log(chalk_1.default.bold('Description: ') + (" " + proj.description));
|
|
84
|
-
}
|
|
85
|
-
log();
|
|
21
|
+
const printItem = (proj) => {
|
|
22
|
+
if (proj.archived && !program.archived) return;
|
|
23
|
+
log(chalk.default.bold(`#${proj.id}`) + chalk.default.blue(` ${proj.name}`));
|
|
24
|
+
log(chalk.default.bold("Points: ") + ` ${proj.stats.num_points}`);
|
|
25
|
+
log(chalk.default.bold("Stories: ") + ` ${proj.stats.num_stories}`);
|
|
26
|
+
log(chalk.default.bold("Started: ") + ` ${proj.start_time}`);
|
|
27
|
+
if (proj.archived) log(chalk.default.bold("Archived: ") + ` ${proj.archived}`);
|
|
28
|
+
if (program.detailed) log(chalk.default.bold("Description: ") + ` ${proj.description}`);
|
|
29
|
+
log();
|
|
86
30
|
};
|
|
87
31
|
main();
|
|
88
|
-
|
|
32
|
+
|
|
33
|
+
//#endregion
|