@@ 411-429 (lines=19) @@ | ||
408 | ) |
|
409 | ||
410 | ||
411 | def _import(subs, shared): |
|
412 | """Configure the `doorstop import` subparser.""" |
|
413 | info = "import an existing document or item" |
|
414 | sub = subs.add_parser( |
|
415 | 'import', description=info.capitalize() + '.', help=info, **shared |
|
416 | ) |
|
417 | sub.add_argument( |
|
418 | 'path', nargs='?', help="path to previously exported document file" |
|
419 | ) |
|
420 | sub.add_argument('prefix', nargs='?', help="prefix of document for import") |
|
421 | group = sub.add_mutually_exclusive_group() |
|
422 | group.add_argument( |
|
423 | '-d', |
|
424 | '--document', |
|
425 | nargs=2, |
|
426 | metavar='ARG', |
|
427 | help="import an existing document by: PREFIX PATH", |
|
428 | ) |
|
429 | group.add_argument( |
|
430 | '-i', |
|
431 | '--item', |
|
432 | nargs=2, |
|
@@ 450-468 (lines=19) @@ | ||
447 | ) |
|
448 | ||
449 | ||
450 | def _export(subs, shared): |
|
451 | """Configure the `doorstop export` subparser.""" |
|
452 | info = "export a document as YAML or another format" |
|
453 | sub = subs.add_parser( |
|
454 | 'export', description=info.capitalize() + '.', help=info, **shared |
|
455 | ) |
|
456 | sub.add_argument('prefix', help="prefix of document to export or 'all'") |
|
457 | sub.add_argument( |
|
458 | 'path', nargs='?', help="path to exported file or directory for 'all'" |
|
459 | ) |
|
460 | group = sub.add_mutually_exclusive_group() |
|
461 | group.add_argument( |
|
462 | '-y', '--yaml', action='store_true', help="output YAML (default when no path)" |
|
463 | ) |
|
464 | group.add_argument( |
|
465 | '-c', '--csv', action='store_true', help="output CSV (default for 'all')" |
|
466 | ) |
|
467 | group.add_argument('-t', '--tsv', action='store_true', help="output TSV") |
|
468 | group.add_argument('-x', '--xlsx', action='store_true', help="output XLSX") |
|
469 | sub.add_argument('-w', '--width', type=int, help="limit line width on text output") |
|
470 | ||
471 |