Skip to content

Commit

Permalink
add url, token and insecure parameters to report and sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskbx committed Jan 31, 2019
1 parent d290a42 commit 7a53ab9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/gtt-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,31 @@ function collect(val, arr) {
// set options
program
.arguments('[project] [ids]')
.option('-e --type <type>', 'specify the query type: project, user, group')
.option('--subgroups', 'include sub groups')
.option('--url <url>', 'URL to GitLabs API')
.option('--token <token>', 'API access token')
.option('-p --proxy <proxy>', 'use a proxy server with the given url')
.option('--insecure', 'don\'t check certificates')
.option('-f --from <from>', 'query times that are equal or greater than the given date')
.option('-t --to <to>', 'query times that are equal or smaller than the given date')
.option('--today', 'ignores --from and --to and queries entries for today')
.option('--this_week', 'ignores --from and --to and queries entries for this week')
.option('--this_month', 'ignores --from and --to and queries entries for this month')
.option('-c --closed', 'include closed issues')
.option('-u --user <user>', 'only query times from the given user')
.option('-m --milestone <milestone>', 'include issues from the given milestone')
.option('--hours_per_day <hours>', 'hours per day for human readable time formats')
.option('-u --user <user>', 'only query times from the given user')
.option('-q --query <query>', 'query the given data types: issues, merge_requests', collect, null)
.option('-e --type <type>', 'specify the query type: project, user, group')
.option('-r --report <report>', 'include in the report: stats, issues, merge_requests, records', collect, null)
.option('-o --output <output>', 'use the given output')
.option('-l --file <file>', 'save report to the given file')
.option('--subgroups', 'include sub groups')
.option('--include_by_labels <labels>', 'only include issues that have the given labels', collect, null)
.option('--exclude_by_labels <labels>', 'exclude issues that have the given labels', collect, null)
.option('--include_labels <labels>', 'only include the given labels in the report', collect, null)
.option('--exclude_labels <labels>', 'exclude the given labels in the report', collect, null)
.option('--date_format <date>', 'use the given date format in the report', collect, null)
.option('--time_format <time>', 'use the given time format in the report')
.option('--hours_per_day <hours>', 'hours per day for human readable time formats')
.option('--no_headlines', 'hide headlines in the report')
.option('--no_warnings', 'hide warnings in the report')
.option('--record_columns <columns>', 'include the given columns in the record part of the report', collect, null)
Expand All @@ -59,7 +63,6 @@ program
.option('--quiet', 'only output report')
.option('--verbose', 'show verbose output')
.option('--show_without_times', 'show issues/merge requests without time records')
.option('-p --proxy <proxy>', 'use a proxy server with the given url')
.option('--from_dump <file>', 'instead of querying gitlab, use data from the given dump file')
.parse(process.argv);

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

// overwrite config with args and opts
config
.set('url', program.url)
.set('token', program.token)
.set('insecure', program.insecure)
.set('project', cli.project())
.set('iids', cli.iids())
.set('from', program.from)
Expand Down Expand Up @@ -346,4 +352,4 @@ new Promise(resolve => {
.then(() => Cli.mark())

// time for a beer
.then(() => Cli.done());
.then(() => Cli.done());
6 changes: 6 additions & 0 deletions src/gtt-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ const Owner = require('./models/owner');

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

Cli.verbose = program.verbose;

let config = new Config(process.cwd())
.set('url', program.url)
.set('token', program.token)
.set('insecure', program.insecure)
.set('proxy', program.proxy);
tasks = new Tasks(config),
owner = new Owner(config);
Expand Down

0 comments on commit 7a53ab9

Please sign in to comment.