Code Duplication    Length = 20-36 lines in 2 locations

doorstop/cli/main.py 2 locations

@@ 446-481 (lines=36) @@
443
    )
444
445
446
def _import(subs, shared):
447
    """Configure the `doorstop import` subparser."""
448
    info = "import an existing document or item"
449
    sub = subs.add_parser(
450
        "import", description=info.capitalize() + ".", help=info, **shared
451
    )
452
    sub.add_argument(
453
        "path", nargs="?", help="path to previously exported document file"
454
    )
455
    sub.add_argument("prefix", nargs="?", help="prefix of document for import")
456
    group = sub.add_mutually_exclusive_group()
457
    group.add_argument(
458
        "-d",
459
        "--document",
460
        nargs=2,
461
        metavar="ARG",
462
        help="import an existing document by: PREFIX PATH",
463
    )
464
    group.add_argument(
465
        "-i",
466
        "--item",
467
        nargs=2,
468
        metavar="ARG",
469
        help="import an existing item by: PREFIX UID",
470
    )
471
    sub.add_argument(
472
        "-p",
473
        "--parent",
474
        metavar="PREFIX",
475
        help="parent document prefix for imported document",
476
    )
477
    sub.add_argument(
478
        "-a", "--attrs", metavar="DICT", help="dictionary of item attributes to import"
479
    )
480
    sub.add_argument(
481
        "-m", "--map", metavar="DICT", help="dictionary of custom item attribute names"
482
    )
483
484
@@ 485-504 (lines=20) @@
482
    )
483
484
485
def _export(subs, shared):
486
    """Configure the `doorstop export` subparser."""
487
    info = "export a document as YAML or another format"
488
    sub = subs.add_parser(
489
        "export", description=info.capitalize() + ".", help=info, **shared
490
    )
491
    sub.add_argument("prefix", help="prefix of document to export or 'all'")
492
    sub.add_argument(
493
        "path", nargs="?", help="path to exported file or directory for 'all'"
494
    )
495
    group = sub.add_mutually_exclusive_group()
496
    group.add_argument(
497
        "-y", "--yaml", action="store_true", help="output YAML (default when no path)"
498
    )
499
    group.add_argument(
500
        "-c", "--csv", action="store_true", help="output CSV (default for 'all')"
501
    )
502
    group.add_argument("-t", "--tsv", action="store_true", help="output TSV")
503
    group.add_argument("-x", "--xlsx", action="store_true", help="output XLSX")
504
    sub.add_argument("-w", "--width", type=int, help="limit line width on text output")
505
506
507
def _publish(subs, shared):