From 77309d64f5d2dd34e7d56684e8b05634cb27019d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Sat, 3 Oct 2015 15:23:17 +0200 Subject: [PATCH] Use option prefix also for git, header and footer This is to make it consistent with the rest of plugins and also to prevent possible option naming collisions. Documentation has been updated accordingly. --- did/cli.py | 2 +- did/plugins/git.py | 2 +- did/stats.py | 3 +- docs/examples.rst | 130 +++++++++++++++++++++++---------------------- 4 files changed, 71 insertions(+), 66 deletions(-) diff --git a/did/cli.py b/did/cli.py index 2cbdf951..6ee2edee 100644 --- a/did/cli.py +++ b/did/cli.py @@ -31,7 +31,7 @@ class Options(object): def __init__(self, arguments=None): """ Prepare the parser. """ self.parser = argparse.ArgumentParser( - usage="did [this|last] [week|month|quarter|year] [opts]") + usage="did [this|last] [week|month|quarter|year] [options]") self.arguments = arguments self.opt = self.arg = None diff --git a/did/plugins/git.py b/did/plugins/git.py index 0d6d0a1a..5e248431 100644 --- a/did/plugins/git.py +++ b/did/plugins/git.py @@ -132,5 +132,5 @@ def __init__(self, option, name=None, parent=None, user=None): name="Work on {0}/{1}".format(repo, repo_dir))) else: self.stats.append(GitCommits( - option=repo, parent=self, path=path, + option=option + "-" + repo, parent=self, path=path, name="Work on {0}".format(repo))) diff --git a/did/stats.py b/did/stats.py index 6476fc27..503d4db7 100644 --- a/did/stats.py +++ b/did/stats.py @@ -204,4 +204,5 @@ class EmptyStatsGroup(StatsGroup): def __init__(self, option, name=None, parent=None, user=None): StatsGroup.__init__(self, option, name, parent, user) for opt, name in sorted(did.base.Config().section(option)): - self.stats.append(EmptyStats(opt, name, parent=self)) + self.stats.append( + EmptyStats(option + "-" + opt, name, parent=self)) diff --git a/docs/examples.rst b/docs/examples.rst index 10bab863..20513c3f 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -19,7 +19,7 @@ trac, plus my favorite header & footer I'm used to fill manually:: [header] type = header - highlights = Highlights + high = Highlights joy = Joy of the week ;-) [tools] @@ -50,56 +50,60 @@ Here's how available command line options look like with this config. Note that ``did`` detects all enabled plugins and creates corresponding option groups for each of them:: - Usage: did [last] [week|month|quarter|year] [opts] - - Options: - -h, --help show this help message and exit - - Selection: - --email=EMAILS User email address(es) - --since=SINCE Start date in the YYYY-MM-DD format - --until=UNTIL End date in the YYYY-MM-DD format - - Header: - --highlights Highlights - --joy Joy of the week - --header All above - - Bugzilla stats: - --bz-filed Bugs filed - --bz-patched Bugs patched - --bz-posted Bugs posted - --bz-fixed Bugs fixed - --bz-returned Bugs returned - --bz-verified Bugs verified - --bz-commented Bugs commented - --bz All above - - Work on tools: - --did Work on did - --edd Work on edd - --tools All above - - Tickets in trac: - --trac-created Tickets created in trac - --trac-accepted Tickets accepted in trac - --trac-updated Tickets updated in trac - --trac-closed Tickets closed in trac - --trac All above - - Footer: - --next Plans, thoughts, ideas... - --status Status: Green | Yellow | Orange | Red - --footer All above - - Display mode: - --format=FORMAT Output style, possible values: text (default) or wiki - --width=WIDTH Maximum width of the report output (default: 79) - --brief Show brief summary only, do not list individual items - --verbose Include more details (like modified git directories) - --total Append total stats after listing individual users - --merge Merge stats of all users into a single report - --debug Turn on debugging output, do not catch exceptions + usage: did [this|last] [week|month|quarter|year] [options] + + optional arguments: + -h, --help show this help message and exit + + Select: + --email EMAILS User email address(es) + --since SINCE Start date in the YYYY-MM-DD format + --until UNTIL End date in the YYYY-MM-DD format + + Header: + --header-high Highlights + --header-joy Joy of the week + --header All above + + Bugzilla stats: + --bz-filed Bugs filed + --bz-patched Bugs patched + --bz-posted Bugs posted + --bz-fixed Bugs fixed + --bz-returned Bugs returned + --bz-verified Bugs verified + --bz-commented Bugs commented + --bz-closed Bugs closed + --bz All above + + Work on tools: + --tools-did Work on did + --tools-edd Work on edd + --tools All above + + Tickets in trac: + --trac-created Tickets created in trac + --trac-accepted Tickets accepted in trac + --trac-updated Tickets updated in trac + --trac-closed Tickets closed in trac + --trac All above + + Footer: + --footer-next Plans, thoughts, ideas... + --footer-status Status: Green | Yellow | Orange | Red + --footer All above + + Format: + --format FORMAT Output style, possible values: text (default) or wiki + --width WIDTH Maximum width of the report output (default: 79) + --brief Show brief summary only, do not list individual items + --verbose Include more details (like modified git directories) + + Utils: + --config FILE Use alternate configuration file (default: 'config') + --total Append total stats after listing individual users + --merge Merge stats of all users into a single report + --debug Turn on debugging output, do not catch exceptions Week @@ -109,19 +113,19 @@ Now it's easy to find out what I was working on during this week:: > did Status report for this week (2015-09-07 to 2015-09-13). - + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Petr Šplíchal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - + * Highlights - + * Joy of the week - + * Bugs fixed: 2 * BZ#1261963 - wrong date format causes traceback * BZ#1248551 - status-report crashes when trac url is incorrect - + * Work on did: 52 commits * 91ae8e7 - Enabled syntax highlighting for config example * 978add5 - Convert plugin order list into table @@ -136,13 +140,13 @@ Now it's easy to find out what I was working on during this week:: * d623ef0 - Clarify a bit more did.cli.main() usage * 72aaa5d - Move module description to the module itself * ... - + * Tickets updated in trac: 2 * TT#0400 - Convert status-report to an open source project * TT#0490 - Add or improve missing test coverage for key use cases * Plans, thoughts, ideas... - + * Status: Green | Yellow | Orange | Red @@ -153,16 +157,16 @@ I can check my work on tools development during the last month:: > did --tools last month Status report for the last month (2015-08-01 to 2015-08-31). - + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Petr Šplíchal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - + * Work on did: 3 commits * 6167e4f - Adjustments after the stats refactoring * 3df5c60 - Include gerrit details as comments, fix exception * 6bc869f - Include 'items' plugin config example - + * Work on edd: 13 commits * 77d5c94 - Bail out if no file selected with --list [fix #5] * eb4db1a - Document the Ctrl-Shift-V keyboard shortcut @@ -178,7 +182,7 @@ I can check my work on tools development during the last month:: * dec9d63 - New option --shortcut for keyboard shortcut * 556d3c4 - Include a short usage message - + Brief ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -189,7 +193,7 @@ instead of typing the whole date string:: > did --bz-filed --bz-fixed --bz-verified --until today --brief Status report for given date range (1993-01-01 to 2015-09-11). - + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Petr Šplíchal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~