Skip to content

Commit

Permalink
Integrate with hamster-lib, fix hint format
Browse files Browse the repository at this point in the history
  • Loading branch information
elbenfreund committed Dec 8, 2016
1 parent 00bb7c2 commit cd4b024
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hamster_cli/hamster_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def _start(controler, raw_fact, start, end):

@run.command(help=help_strings.STOP_HELP)
@click.option('--end', nargs=1, default=None, help=_(
"Specify an end date other than *now* ('%Y-%m-%d')"))
"Specify an end time other than *now* ('H:M)"))
@pass_controler
def stop(controler, end):
"""Stop tracking current fact. Saving the result."""
Expand All @@ -320,11 +320,13 @@ def _stop(controler, end=None):
ValueError: If ``--end`` was passed but can not be recognized.
"""
if end:
end_time = datetime.datetime.strptime(end, '%Y-%m-%d').time
end_time = datetime.datetime.strptime(end, '%H:%M').time()
end = datetime.datetime.combine(datetime.date.today(), end_time)
else:
end = None

try:
fact = controler.facts.stop_tmp_fact()
fact = controler.facts.stop_tmp_fact(end_hint=end)
except ValueError:
message = _(
"Unable to continue temporary fact. Are you sure there is one?"
Expand Down

0 comments on commit cd4b024

Please sign in to comment.