--user option added to limit output

This commit is contained in:
Alexandre Dulaunoy 2012-05-29 09:40:48 +02:00
parent deeb3ac156
commit bb11a2ad1c
2 changed files with 5 additions and 2 deletions

View file

@ -21,6 +21,7 @@ Usage
repository/project
-f FORMAT, --outputformat=FORMAT
output format text, csv (default is text)
-u USER, --user=USER limit timesheet to the user specified
Sample output

View file

@ -61,6 +61,7 @@ parser.add_option("-d", "--debug", action="store_true", dest="debug", help="outp
parser.add_option("-w", "--commitfactor", dest="commitfactor", help="work time factor per commit, default is 4 hours",default=4, type="int")
parser.add_option("-t", "--total", action="store_true", dest="total", help="total hours worked for each user per repository/project", default=False)
parser.add_option("-f", "--outputformat", dest="format", help="output format text, csv (default is text)", default="text", type="string")
parser.add_option("-u", "--user", dest="user", help="limit timesheet to the user specified", default=None, type="string")
(options, args) = parser.parse_args()
@ -78,7 +79,8 @@ for repo in args:
(name, email, when, message) = line.split("|")
except:
continue
print logmessage(name=unicode(name), email=email, when=float(when), commitfactor = options.commitfactor, message=unicode(message), repo = os.path.basename(os.path.normpath(repo)), format=options.format)
if name == options.user or options.user is None:
print logmessage(name=unicode(name), email=email, when=float(when), commitfactor = options.commitfactor, message=unicode(message), repo = os.path.basename(os.path.normpath(repo)), format=options.format)