Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
oss
gitlabtime
Commits
d63064ef
Commit
d63064ef
authored
Aug 02, 2020
by
Thomas Lotze
Browse files
add filter for month to report
parent
2f79c5f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/gitlabtime/cli.py
View file @
d63064ef
...
...
@@ -14,8 +14,12 @@ import click
help
=
'Access token'
,
prompt
=
'Access token'
,
)
def
cli
(
url
,
token
):
entries
=
fetch
(
url
,
token
)
@
click
.
option
(
'--month'
,
help
=
'Filter for month (yyyy-mm)'
,
)
def
cli
(
url
,
token
,
month
):
entries
=
fetch
(
url
,
token
,
month
)
report
(
entries
)
...
...
src/gitlabtime/fetch.py
View file @
d63064ef
...
...
@@ -23,7 +23,7 @@ def parse_time(time_str):
return
float
(
value_str
)
*
unit
def
fetch
(
url
,
token
):
def
fetch
(
url
,
token
,
month
):
"""Yield all relevant time tracking entries, in no particular order.
"""
...
...
@@ -59,6 +59,9 @@ def fetch(url, token):
if
_
!=
sep
:
continue
if
month
and
not
date
.
startswith
(
month
):
continue
seconds
=
parse_action
(
action
)
entries
[
note
.
author
[
'username'
],
date
]
+=
seconds
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment