Code Duplication    Length = 19-25 lines in 2 locations

doorstop/cli/main.py 2 locations

@@ 158-182 (lines=25) @@
155
    sub.add_argument('uid', help="item UID to remove from its document")
156
157
158
def _edit(subs, shared):
159
    """Configure the `doorstop edit` subparser."""
160
    info = "open an existing item or document for editing"
161
    sub = subs.add_parser('edit', description=info.capitalize() + '.',
162
                          help=info, **shared)
163
    sub.add_argument('label',
164
                     help="item UID or document prefix to open for editing")
165
    group = sub.add_mutually_exclusive_group()
166
    group.add_argument('-i', '--item', action='store_true',
167
                       help="indicates the 'label' is an item UID")
168
    group.add_argument('-d', '--document', action='store_true',
169
                       help="indicates the 'label' is a document prefix")
170
    group = sub.add_mutually_exclusive_group()
171
    group.add_argument('-y', '--yaml', action='store_true',
172
                       help="edit document as exported YAML (default)")
173
    group.add_argument('-c', '--csv', action='store_true',
174
                       help="edit document as exported CSV")
175
    group.add_argument('-t', '--tsv', action='store_true',
176
                       help="edit document as exported TSV")
177
    group.add_argument('-x', '--xlsx', action='store_true',
178
                       help="edit document as exported XLSX")
179
    required = sub.add_argument_group('required arguments')
180
    required.add_argument('-T', '--tool', metavar='PROGRAM',
181
                          help="text editor to open the document item",
182
                          required=True)
183
184
185
def _reorder(subs, shared):
@@ 248-266 (lines=19) @@
245
                       help="indicates the 'label' is a document prefix")
246
247
248
def _import(subs, shared):
249
    """Configure the `doorstop import` subparser."""
250
    info = "import an existing document or item"
251
    sub = subs.add_parser('import', description=info.capitalize() + '.',
252
                          help=info, **shared)
253
    sub.add_argument('path', nargs='?',
254
                     help="path to previously exported document file")
255
    sub.add_argument('prefix', nargs='?', help="prefix of document for import")
256
    group = sub.add_mutually_exclusive_group()
257
    group.add_argument('-d', '--document', nargs=2, metavar='ARG',
258
                       help="import an existing document by: PREFIX PATH")
259
    group.add_argument('-i', '--item', nargs=2, metavar='ARG',
260
                       help="import an existing item by: PREFIX UID")
261
    sub.add_argument('-p', '--parent', metavar='PREFIX',
262
                     help="parent document prefix for imported document")
263
    sub.add_argument('-a', '--attrs', metavar='DICT',
264
                     help="dictionary of item attributes to import")
265
    sub.add_argument('-m', '--map', metavar='DICT',
266
                     help="dictionary of custom item attribute names")
267
268
269
def _export(subs, shared):