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

Commit dd22a95

Browse files
committed
feat(report): add last_month option
1 parent cec2a90 commit dd22a95

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ There are some quick shorthands:
296296
gtt report --today
297297
gtt report --this_week
298298
gtt report --this_month
299+
gtt report --last_month
299300
```
300301

301302
#### Include closed issues/merge requests

src/gtt-report.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ program
3434
.option('--today', 'ignores --from and --to and queries entries for today')
3535
.option('--this_week', 'ignores --from and --to and queries entries for this week')
3636
.option('--this_month', 'ignores --from and --to and queries entries for this month')
37+
.option('--last_month', 'ignores --from and --to and queries entries for last month')
3738
.option('-c --closed', 'include closed issues')
3839
.option('-u --user <user>', 'only query times from the given user')
3940
.option('-m --milestone <milestone>', 'include issues from the given milestone')
@@ -132,6 +133,10 @@ if (program.this_month)
132133
config
133134
.set('from', moment().startOf('month'))
134135
.set('to', moment().endOf('month'));
136+
if (program.last_month)
137+
config
138+
.set('from', moment().subtract(1, 'month').startOf('month'))
139+
.set('to', moment().subtract(1, 'month').endOf('month'));
135140

136141
Cli.quiet = config.get('quiet');
137142
Cli.verbose = config.get('_verbose');
@@ -346,4 +351,4 @@ new Promise(resolve => {
346351
.then(() => Cli.mark())
347352

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

0 commit comments

Comments
 (0)