Code Duplication    Length = 19-25 lines in 2 locations

doorstop/cli/main.py 2 locations

@@ 170-194 (lines=25) @@
167
    sub.add_argument('uid', help="item UID to remove from its document")
168
169
170
def _edit(subs, shared):
171
    """Configure the `doorstop edit` subparser."""
172
    info = "open an existing item or document for editing"
173
    sub = subs.add_parser('edit', description=info.capitalize() + '.',
174
                          help=info, **shared)
175
    sub.add_argument('label',
176
                     help="item UID or document prefix to open for editing")
177
    group = sub.add_mutually_exclusive_group()
178
    group.add_argument('-i', '--item', action='store_true',
179
                       help="indicates the 'label' is an item UID")
180
    group.add_argument('-d', '--document', action='store_true',
181
                       help="indicates the 'label' is a document prefix")
182
    group = sub.add_mutually_exclusive_group()
183
    group.add_argument('-y', '--yaml', action='store_true',
184
                       help="edit document as exported YAML (default)")
185
    group.add_argument('-c', '--csv', action='store_true',
186
                       help="edit document as exported CSV")
187
    group.add_argument('-t', '--tsv', action='store_true',
188
                       help="edit document as exported TSV")
189
    group.add_argument('-x', '--xlsx', action='store_true',
190
                       help="edit document as exported XLSX")
191
    required = sub.add_argument_group('required arguments')
192
    required.add_argument('-T', '--tool', metavar='PROGRAM',
193
                          help="text editor to open the document item",
194
                          required=True)
195
196
197
def _reorder(subs, shared):
@@ 260-278 (lines=19) @@
257
                       help="indicates the 'label' is a document prefix")
258
259
260
def _import(subs, shared):
261
    """Configure the `doorstop import` subparser."""
262
    info = "import an existing document or item"
263
    sub = subs.add_parser('import', description=info.capitalize() + '.',
264
                          help=info, **shared)
265
    sub.add_argument('path', nargs='?',
266
                     help="path to previously exported document file")
267
    sub.add_argument('prefix', nargs='?', help="prefix of document for import")
268
    group = sub.add_mutually_exclusive_group()
269
    group.add_argument('-d', '--document', nargs=2, metavar='ARG',
270
                       help="import an existing document by: PREFIX PATH")
271
    group.add_argument('-i', '--item', nargs=2, metavar='ARG',
272
                       help="import an existing item by: PREFIX UID")
273
    sub.add_argument('-p', '--parent', metavar='PREFIX',
274
                     help="parent document prefix for imported document")
275
    sub.add_argument('-a', '--attrs', metavar='DICT',
276
                     help="dictionary of item attributes to import")
277
    sub.add_argument('-m', '--map', metavar='DICT',
278
                     help="dictionary of custom item attribute names")
279
280
281
def _export(subs, shared):