Skip to content
This repository has been archived by the owner on Sep 23, 2018. It is now read-only.

Commit

Permalink
Add configurable date and time to output of status command (fixes j…
Browse files Browse the repository at this point in the history
…azzband#33, `strftime` version)
  • Loading branch information
SpotlightKid committed Oct 19, 2015
1 parent 28cc75d commit e8582ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions watson/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,16 @@ def status(watson):
return

current = watson.current
click.echo("Project {} {} started {}".format(
options = (dict(watson.config.items('options'))
if watson.config.has_section('options') else {})
datefmt = options.get('date_format', '%Y.%m.%d')
timefmt = options.get('time_format', '%H:%M:%S%z')
click.echo("Project {} {} started {} ({} {})".format(
style('project', current['project']),
style('tags', current['tags']),
style('time', current['start'].humanize())
style('time', current['start'].humanize()),
style('date', current['start'].strftime(datefmt)),
style('time', current['start'].strftime(timefmt))
))


Expand Down
5 changes: 3 additions & 2 deletions watson/watson.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

try:
import configparser
from configparser import ConfigParser
from functools import partial
ConfigParser = partial(configparser.ConfigParser, interpolation=None)
except ImportError:
import ConfigParser as configparser # noqa
from ConfigParser import SafeConfigParser as ConfigParser # noqa
from ConfigParser import RawConfigParser as ConfigParser # noqa

import arrow
import click
Expand Down

0 comments on commit e8582ae

Please sign in to comment.