Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 7a53ab9

Browse files
committed
add url, token and insecure parameters to report and sync
1 parent d290a42 commit 7a53ab9

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/gtt-report.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,31 @@ function collect(val, arr) {
2929
// set options
3030
program
3131
.arguments('[project] [ids]')
32+
.option('-e --type <type>', 'specify the query type: project, user, group')
33+
.option('--subgroups', 'include sub groups')
34+
.option('--url <url>', 'URL to GitLabs API')
35+
.option('--token <token>', 'API access token')
36+
.option('-p --proxy <proxy>', 'use a proxy server with the given url')
37+
.option('--insecure', 'don\'t check certificates')
3238
.option('-f --from <from>', 'query times that are equal or greater than the given date')
3339
.option('-t --to <to>', 'query times that are equal or smaller than the given date')
3440
.option('--today', 'ignores --from and --to and queries entries for today')
3541
.option('--this_week', 'ignores --from and --to and queries entries for this week')
3642
.option('--this_month', 'ignores --from and --to and queries entries for this month')
3743
.option('-c --closed', 'include closed issues')
38-
.option('-u --user <user>', 'only query times from the given user')
3944
.option('-m --milestone <milestone>', 'include issues from the given milestone')
45+
.option('--hours_per_day <hours>', 'hours per day for human readable time formats')
46+
.option('-u --user <user>', 'only query times from the given user')
4047
.option('-q --query <query>', 'query the given data types: issues, merge_requests', collect, null)
41-
.option('-e --type <type>', 'specify the query type: project, user, group')
4248
.option('-r --report <report>', 'include in the report: stats, issues, merge_requests, records', collect, null)
4349
.option('-o --output <output>', 'use the given output')
4450
.option('-l --file <file>', 'save report to the given file')
45-
.option('--subgroups', 'include sub groups')
4651
.option('--include_by_labels <labels>', 'only include issues that have the given labels', collect, null)
4752
.option('--exclude_by_labels <labels>', 'exclude issues that have the given labels', collect, null)
4853
.option('--include_labels <labels>', 'only include the given labels in the report', collect, null)
4954
.option('--exclude_labels <labels>', 'exclude the given labels in the report', collect, null)
5055
.option('--date_format <date>', 'use the given date format in the report', collect, null)
5156
.option('--time_format <time>', 'use the given time format in the report')
52-
.option('--hours_per_day <hours>', 'hours per day for human readable time formats')
5357
.option('--no_headlines', 'hide headlines in the report')
5458
.option('--no_warnings', 'hide warnings in the report')
5559
.option('--record_columns <columns>', 'include the given columns in the record part of the report', collect, null)
@@ -59,7 +63,6 @@ program
5963
.option('--quiet', 'only output report')
6064
.option('--verbose', 'show verbose output')
6165
.option('--show_without_times', 'show issues/merge requests without time records')
62-
.option('-p --proxy <proxy>', 'use a proxy server with the given url')
6366
.option('--from_dump <file>', 'instead of querying gitlab, use data from the given dump file')
6467
.parse(process.argv);
6568

@@ -87,6 +90,9 @@ if (program.output === "dump") {
8790

8891
// overwrite config with args and opts
8992
config
93+
.set('url', program.url)
94+
.set('token', program.token)
95+
.set('insecure', program.insecure)
9096
.set('project', cli.project())
9197
.set('iids', cli.iids())
9298
.set('from', program.from)
@@ -346,4 +352,4 @@ new Promise(resolve => {
346352
.then(() => Cli.mark())
347353

348354
// time for a beer
349-
.then(() => Cli.done());
355+
.then(() => Cli.done());

src/gtt-sync.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ const Owner = require('./models/owner');
88

99
program
1010
.option('-p --proxy <proxy>', 'use a proxy server with the given url')
11+
.option('--url <url>', 'URL to GitLabs API')
12+
.option('--token <token>', 'API access token')
13+
.option('--insecure', 'don\'t check certificates')
1114
.option('--verbose', 'show verbose output')
1215
.parse(process.argv);
1316

1417
Cli.verbose = program.verbose;
1518

1619
let config = new Config(process.cwd())
20+
.set('url', program.url)
21+
.set('token', program.token)
22+
.set('insecure', program.insecure)
1723
.set('proxy', program.proxy);
1824
tasks = new Tasks(config),
1925
owner = new Owner(config);

0 commit comments

Comments
 (0)