diff --git a/documentation.md b/documentation.md index fdef25a..8fca6bd 100644 --- a/documentation.md +++ b/documentation.md @@ -296,6 +296,7 @@ There are some quick shorthands: gtt report --today gtt report --this_week gtt report --this_month +gtt report --last_month ``` #### Include closed issues/merge requests diff --git a/src/gtt-report.js b/src/gtt-report.js index fcbb76b..0b34ade 100755 --- a/src/gtt-report.js +++ b/src/gtt-report.js @@ -34,6 +34,7 @@ program .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('--last_month', 'ignores --from and --to and queries entries for last month') .option('-c --closed', 'include closed issues') .option('-u --user ', 'only query times from the given user') .option('-m --milestone ', 'include issues from the given milestone') @@ -132,6 +133,10 @@ if (program.this_month) config .set('from', moment().startOf('month')) .set('to', moment().endOf('month')); +if (program.last_month) + config + .set('from', moment().subtract(1, 'month').startOf('month')) + .set('to', moment().subtract(1, 'month').endOf('month')); Cli.quiet = config.get('quiet'); Cli.verbose = config.get('_verbose'); @@ -346,4 +351,4 @@ new Promise(resolve => { .then(() => Cli.mark()) // time for a beer - .then(() => Cli.done()); \ No newline at end of file + .then(() => Cli.done());