Mercurial > p > roundup > code
comparison roundup/admin.py @ 8393:e5d07fac0249
build: remove extra <p></p> generated by blank lines.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 12 Jul 2025 22:55:39 -0400 |
| parents | 4d3b371ed543 |
| children | 1a93dc58f975 |
comparison
equal
deleted
inserted
replaced
| 8392:a0f9ef08c36c | 8393:e5d07fac0249 |
|---|---|
| 259 key=operator.attrgetter('__name__')) | 259 key=operator.attrgetter('__name__')) |
| 260 print("<table>") | 260 print("<table>") |
| 261 for command in commands: | 261 for command in commands: |
| 262 h = _(command.__doc__).split('\n') | 262 h = _(command.__doc__).split('\n') |
| 263 name = command.__name__[3:] | 263 name = command.__name__[3:] |
| 264 usage = h[0].replace('<','<').replace('>','>')[7:] | 264 # first line is "<name> <params and stuff> |
| 265 usage = h[0][len(name) + 1:].replace('<','<').replace('>','>')[7:] | |
| 265 print(""" | 266 print(""" |
| 266 <tr><td valign=top><strong>%(name)s</strong></td> | 267 <tr><td valign=top><strong>%(name)s</strong></td> |
| 267 <td><tt>- %(usage)s</tt> | 268 <td><p><tt>%(usage)s</tt></p> |
| 268 <pre>""" % locals()) | 269 """ % locals()) |
| 269 indent = indent_re.match(h[1]) | 270 indent = indent_re.match(h[1]) |
| 270 if indent: indent = len(indent.group(1)) # noqa: E701 | 271 if indent: indent = len(indent.group(1)) # noqa: E701 |
| 271 for line in h[1:]: | 272 lines_to_process = len(h[1:]) |
| 273 print('<p>') | |
| 274 for lineno, line in enumerate(h[1:]): | |
| 272 line = line.replace('<','<').replace('>','>') | 275 line = line.replace('<','<').replace('>','>') |
| 273 if indent: | 276 if indent: |
| 274 print(line[indent:]) | 277 clean_line = line[indent:] |
| 275 else: | 278 else: |
| 276 print(line) | 279 clean_line = line |
| 277 print('</pre></td></tr>\n') | 280 if not clean_line: |
| 281 print('</p><p>') | |
| 282 continue | |
| 283 if clean_line.startswith(' '): # indented example line | |
| 284 print("<pre>%s</pre>" % clean_line) | |
| 285 else: | |
| 286 print(clean_line) | |
| 287 if lineno == lines_to_process: | |
| 288 print('</p>') | |
| 289 print('</td></tr>\n') | |
| 278 print("</table>") | 290 print("</table>") |
| 279 | 291 |
| 280 def help_all(self): | 292 def help_all(self): |
| 281 print(_(""" | 293 print(_(""" |
| 282 All commands (except help) require a tracker specifier. This is just | 294 All commands (except help) require a tracker specifier. This is just |
| 855 return 0 | 867 return 0 |
| 856 | 868 |
| 857 def do_genconfig(self, args, update=False): | 869 def do_genconfig(self, args, update=False): |
| 858 ''"""Usage: genconfig filename | 870 ''"""Usage: genconfig filename |
| 859 Create a new tracker config file with default values in filename. | 871 Create a new tracker config file with default values in filename. |
| 872 See also updateconfig. | |
| 860 """ | 873 """ |
| 861 if len(args) < 1: | 874 if len(args) < 1: |
| 862 raise UsageError(_('Not enough arguments supplied')) | 875 raise UsageError(_('Not enough arguments supplied')) |
| 863 | 876 |
| 864 if update: | 877 if update: |
| 1209 The directory should have the same format as one containing | 1222 The directory should have the same format as one containing |
| 1210 the output of export. There are two files imported per class. | 1223 the output of export. There are two files imported per class. |
| 1211 The files used in the import are: | 1224 The files used in the import are: |
| 1212 | 1225 |
| 1213 <class>.csv | 1226 <class>.csv |
| 1214 This must define the same properties as the class (including | 1227 This must define the same properties as the class |
| 1215 having a "header" line with those property names.) | 1228 (including having a "header" line with those |
| 1229 property names.) | |
| 1230 | |
| 1216 <class>-journals.csv | 1231 <class>-journals.csv |
| 1217 This defines the journals for the items being imported. | 1232 This defines the journals for the items |
| 1233 being imported. | |
| 1218 | 1234 |
| 1219 The imported nodes will have the same nodeid as defined in the | 1235 The imported nodes will have the same nodeid as defined in the |
| 1220 import file, thus replacing any existing content. | 1236 import file, thus replacing any existing content. |
| 1221 | 1237 |
| 1222 The new nodes are added to the existing database - if you want to | 1238 The new nodes are added to the existing database - if you want to |
| 1595 Remove journal entries older than the date/period. | 1611 Remove journal entries older than the date/period. |
| 1596 | 1612 |
| 1597 A period is specified using the suffixes "y", "m", and "d". The | 1613 A period is specified using the suffixes "y", "m", and "d". The |
| 1598 suffix "w" (for "week") means 7 days. | 1614 suffix "w" (for "week") means 7 days. |
| 1599 | 1615 |
| 1600 "3y" means three years | 1616 "3y" means three years |
| 1601 "2y 1m" means two years and one month | 1617 "2y 1m" means two years and one month |
| 1602 "1m 25d" means one month and 25 days | 1618 "1m 25d" means one month and 25 days |
| 1603 "2w 3d" means two weeks and three days | 1619 "2w 3d" means two weeks and three days |
| 1604 | 1620 |
| 1605 Date format is "YYYY-MM-DD" eg: | 1621 Date format is "YYYY-MM-DD" eg: |
| 1606 2001-01-01 | 1622 2001-01-01 |
| 1607 | 1623 |
| 1608 """ | 1624 """ |
| 2084 specified, all properties are displayed. By default, the column | 2100 specified, all properties are displayed. By default, the column |
| 2085 widths are the width of the largest value. The width may be | 2101 widths are the width of the largest value. The width may be |
| 2086 explicitly defined by defining the property as "name:width". | 2102 explicitly defined by defining the property as "name:width". |
| 2087 For example:: | 2103 For example:: |
| 2088 | 2104 |
| 2089 roundup> table priority id,name:10 | 2105 roundup> table priority id,name:10 |
| 2090 Id Name | 2106 Id Name |
| 2091 1 fatal-bug | 2107 1 fatal-bug |
| 2092 2 bug | 2108 2 bug |
| 2093 3 usability | 2109 3 usability |
| 2094 4 feature | 2110 4 feature |
| 2095 | 2111 |
| 2096 Also to make the width of the column the width of the label, | 2112 Also to make the width of the column the width of the label, |
| 2097 leave a trailing : without a width on the property. For example:: | 2113 leave a trailing : without a width on the property. For example:: |
| 2098 | 2114 |
| 2099 roundup> table priority id,name: | 2115 roundup> table priority id,name: |
| 2100 Id Name | 2116 Id Name |
| 2101 1 fata | 2117 1 fata |
| 2102 2 bug | 2118 2 bug |
| 2103 3 usab | 2119 3 usab |
| 2104 4 feat | 2120 4 feat |
| 2105 | 2121 |
| 2106 will result in a the 4 character wide "Name" column. | 2122 will result in a the 4 character wide "Name" column. |
| 2107 """ | 2123 """ |
| 2108 if len(args) < 1: | 2124 if len(args) < 1: |
| 2109 raise UsageError(_('Not enough arguments supplied')) | 2125 raise UsageError(_('Not enough arguments supplied')) |
