Skip to content

Commit 382f27d

Browse files
committed
docs: normalize all help strings and make html output look better.
1 parent ddfa2e9 commit 382f27d

File tree

1 file changed

+43
-32
lines changed

1 file changed

+43
-32
lines changed

roundup/admin.py

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -246,22 +246,25 @@ def help_commands_html(self, indent_re=indent_re):
246246
"""
247247
commands = sorted(iter(self.commands.values()),
248248
key=operator.attrgetter('__name__'))
249+
print("<table>")
249250
for command in commands:
250251
h = _(command.__doc__).split('\n')
251252
name = command.__name__[3:]
252-
usage = h[0]
253+
usage = h[0].replace('<','&lt;').replace('>','&gt;')[7:]
253254
print("""
254255
<tr><td valign=top><strong>%(name)s</strong></td>
255-
<td><tt>%(usage)s</tt><p>
256+
<td><tt>- %(usage)s</tt>
256257
<pre>""" % locals())
257-
indent = indent_re.match(h[3])
258+
indent = indent_re.match(h[1])
258259
if indent: indent = len(indent.group(1)) # noqa: E701
259-
for line in h[3:]:
260+
for line in h[1:]:
261+
line = line.replace('<','&lt;').replace('>','&gt;')
260262
if indent:
261263
print(line[indent:])
262264
else:
263265
print(line)
264266
print('</pre></td></tr>\n')
267+
print("</table>")
265268

266269
def help_all(self):
267270
print(_("""
@@ -540,7 +543,6 @@ def do_create(self, args):
540543

541544
def do_display(self, args):
542545
''"""Usage: display designator[,designator]*
543-
544546
Show the property values for the given node(s).
545547
546548
A designator is a classname and a nodeid concatenated,
@@ -585,16 +587,19 @@ def do_display(self, args):
585587

586588
def do_export(self, args, export_files=True):
587589
''"""Usage: export [[-]class[,class]] export_dir
588-
Export the database to colon-separated-value files.
590+
Export the database and file content.
591+
592+
Database content is exported to colon separated files.
589593
To exclude the files (e.g. for the msg or file class),
590594
use the exporttables command.
591595
592596
Optionally limit the export to just the named classes
593-
or exclude the named classes, if the 1st argument starts with '-'.
597+
or exclude the named classes, if the 1st argument
598+
starts with '-'.
594599
595600
This action exports the current data from the database into
596601
colon-separated-value files that are placed in the nominated
597-
destination directory.
602+
export_dir directory.
598603
"""
599604
# grab the directory to export to
600605
if len(args) < 1:
@@ -697,15 +702,19 @@ class colon_separated(csv.excel):
697702

698703
def do_exporttables(self, args):
699704
''"""Usage: exporttables [[-]class[,class]] export_dir
700-
Export the database to colon-separated-value files, excluding the
701-
files below $TRACKER_HOME/db/files/ (which can be archived separately).
705+
Export only the database to files, no file content.
706+
707+
Database content is exported to colon separated files.
708+
The files below $TRACKER_HOME/db/files/ (which can be
709+
archived separately) are not part of the export.
702710
To include the files, use the export command.
703711
704712
Optionally limit the export to just the named classes
705-
or exclude the named classes, if the 1st argument starts with '-'.
713+
or exclude the named classes, if the 1st argument
714+
starts with '-'.
706715
707716
This action exports the current data from the database into
708-
colon-separated-value files that are placed in the nominated
717+
colon-separated-value files that are placed in the export_dir
709718
destination directory.
710719
"""
711720
return self.do_export(args, export_files=False)
@@ -835,9 +844,8 @@ def do_find(self, args):
835844
return 0
836845

837846
def do_genconfig(self, args, update=False):
838-
''"""Usage: genconfig <filename>
839-
Generate a new tracker config file (ini style) with default
840-
values in <filename>.
847+
''"""Usage: genconfig filename
848+
Create a new tracker config file with default values in filename.
841849
"""
842850
if len(args) < 1:
843851
raise UsageError(_('Not enough arguments supplied'))
@@ -1185,9 +1193,10 @@ def make_readable(hist):
11851193

11861194
def do_import(self, args, import_files=True):
11871195
''"""Usage: import import_dir
1188-
Import a database from the directory containing CSV files,
1189-
two per class to import.
1196+
Import a database and file contents from the directory.
11901197
1198+
The directory should have the same format as one containing
1199+
the output of export. There are two files imported per class.
11911200
The files used in the import are:
11921201
11931202
<class>.csv
@@ -1276,8 +1285,9 @@ class colon_separated(csv.excel):
12761285

12771286
def do_importtables(self, args):
12781287
''"""Usage: importtables export_dir
1279-
12801288
This imports the database tables exported using exporttables.
1289+
1290+
It does not import the content of files like msgs and files.
12811291
"""
12821292
return self.do_import(args, import_files=False)
12831293

@@ -1523,7 +1533,6 @@ def do_list(self, args):
15231533

15241534
def do_migrate(self, args): # noqa: ARG002 - args unused
15251535
''"""Usage: migrate
1526-
15271536
Update a tracker's database to be compatible with the Roundup
15281537
codebase.
15291538
@@ -1553,9 +1562,7 @@ def do_migrate(self, args): # noqa: ARG002 - args unused
15531562

15541563
def do_pack(self, args):
15551564
''"""Usage: pack period | date
1556-
1557-
Remove journal entries older than a period of time specified or
1558-
before a certain date.
1565+
Remove journal entries older than the date/period.
15591566
15601567
A period is specified using the suffixes "y", "m", and "d". The
15611568
suffix "w" (for "week") means 7 days.
@@ -1592,8 +1599,9 @@ def do_pack(self, args):
15921599

15931600
def do_perftest(self, args):
15941601
''"""Usage: perftest [mode] [arguments]*
1602+
Time operations in Roundup.
15951603
1596-
Time operations in Roundup. Supported arguments:
1604+
Supported arguments:
15971605
15981606
[password] [rounds=<integer>] [scheme=<scheme>]
15991607
@@ -1665,7 +1673,9 @@ def do_perftest(self, args):
16651673

16661674
def do_pragma(self, args):
16671675
''"""Usage: pragma setting=value | 'list'
1668-
Set internal admin settings to a value. E.G.
1676+
Set internal admin settings to a value.
1677+
1678+
For example:
16691679
16701680
pragma verbose=True
16711681
pragma verbose=yes
@@ -1877,13 +1887,13 @@ def do_rollback(self, args): # noqa: ARG002 - args unused
18771887

18781888
def do_security(self, args):
18791889
''"""Usage: security [Role name]
1890+
Display the Permissions available to one or all Roles.
18801891
1881-
Display the Permissions available to one or all Roles.
1882-
Also validates that any properties defined in a
1883-
permission are valid.
1892+
Also validates that any properties defined in a
1893+
permission are valid.
18841894
1885-
Run this after changing your permissions to catch
1886-
typos.
1895+
Run this after changing your permissions to catch
1896+
typos.
18871897
"""
18881898
if len(args) == 1:
18891899
role = args[0]
@@ -2167,9 +2177,10 @@ def do_templates(self, args):
21672177

21682178
def do_updateconfig(self, args):
21692179
''"""Usage: updateconfig <filename>
2170-
Generate an updated tracker config file (ini style) in
2171-
<filename>. Use current settings from existing roundup
2172-
tracker in tracker home.
2180+
Merge existing tracker config with new settings.
2181+
2182+
Output the updated config file to <filename>. Use current
2183+
settings from existing roundup tracker in tracker home.
21732184
"""
21742185
self.do_genconfig(args, update=True)
21752186

0 commit comments

Comments
 (0)