Code Duplication    Length = 19-25 lines in 2 locations

doorstop/cli/main.py 2 locations

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