Code Duplication    Length = 19-21 lines in 3 locations

doorstop/cli/main.py 3 locations

@@ 280-300 (lines=21) @@
277
                     help="limit line width on text output")
278
279
280
def _publish(subs, shared):
281
    """Configure the `doorstop publish` subparser."""
282
    info = "publish a document as text or another format"
283
    sub = subs.add_parser('publish', description=info.capitalize() + '.',
284
                          help=info, **shared)
285
    sub.add_argument('prefix', help="prefix of document to publish or 'all'")
286
    sub.add_argument('path', nargs='?',
287
                     help="path to published file or directory for 'all'")
288
    group = sub.add_mutually_exclusive_group()
289
    group.add_argument('-t', '--text', action='store_true',
290
                       help="output text (default when no path)")
291
    group.add_argument('-m', '--markdown', action='store_true',
292
                       help="output Markdown")
293
    group.add_argument('-H', '--html', action='store_true',
294
                       help="output HTML (default for 'all')")
295
    sub.add_argument('-w', '--width', type=int,
296
                     help="limit line width on text output")
297
    sub.add_argument('-C', '--no-child-links', action='store_true',
298
                     help="do not include child links on items")
299
    sub.add_argument('-L', '--no-body-levels', action='store_true',
300
                     help="do not include levels on non-heading items")
301
302
                                                                           # add 27.11.2019 / 11.12.2019
303
def _valMatrix(subs, shared):
@@ 259-277 (lines=19) @@
256
                     help="dictionary of custom item attribute names")
257
258
259
def _export(subs, shared):
260
    """Configure the `doorstop export` subparser."""
261
    info = "export a document as YAML or another format"
262
    sub = subs.add_parser('export', description=info.capitalize() + '.',
263
                          help=info, **shared)
264
    sub.add_argument('prefix', help="prefix of document to export or 'all'")
265
    sub.add_argument('path', nargs='?',
266
                     help="path to exported file or directory for 'all'")
267
    group = sub.add_mutually_exclusive_group()
268
    group.add_argument('-y', '--yaml', action='store_true',
269
                       help="output YAML (default when no path)")
270
    group.add_argument('-c', '--csv', action='store_true',
271
                       help="output CSV (default for 'all')")
272
    group.add_argument('-t', '--tsv', action='store_true',
273
                       help="output TSV")
274
    group.add_argument('-x', '--xlsx', action='store_true',
275
                       help="output XLSX")
276
    sub.add_argument('-w', '--width', type=int,
277
                     help="limit line width on text output")
278
279
280
def _publish(subs, shared):
@@ 238-256 (lines=19) @@
235
                       help="indicates the 'label' is a document prefix")
236
237
238
def _import(subs, shared):
239
    """Configure the `doorstop import` subparser."""
240
    info = "import an existing document or item"
241
    sub = subs.add_parser('import', description=info.capitalize() + '.',
242
                          help=info, **shared)
243
    sub.add_argument('path', nargs='?',
244
                     help="path to previously exported document file")
245
    sub.add_argument('prefix', nargs='?', help="prefix of document for import")
246
    group = sub.add_mutually_exclusive_group()
247
    group.add_argument('-d', '--document', nargs=2, metavar='ARG',
248
                       help="import an existing document by: PREFIX PATH")
249
    group.add_argument('-i', '--item', nargs=2, metavar='ARG',
250
                       help="import an existing item by: PREFIX UID")
251
    sub.add_argument('-p', '--parent', metavar='PREFIX',
252
                     help="parent document prefix for imported document")
253
    sub.add_argument('-a', '--attrs', metavar='DICT',
254
                     help="dictionary of item attributes to import")
255
    sub.add_argument('-m', '--map', metavar='DICT',
256
                     help="dictionary of custom item attribute names")
257
258
259
def _export(subs, shared):