|
@@ 154-178 (lines=25) @@
|
| 151 |
|
"""Configure the `doorstop remove` subparser.""" |
| 152 |
|
info = "remove an item file from a document directory" |
| 153 |
|
sub = subs.add_parser('remove', description=info.capitalize() + '.', |
| 154 |
|
help=info, **shared) |
| 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", |
|
@@ 246-264 (lines=19) @@
|
| 243 |
|
group = sub.add_mutually_exclusive_group() |
| 244 |
|
group.add_argument('-i', '--item', action='store_true', |
| 245 |
|
help="indicates the 'label' is an item UID") |
| 246 |
|
group.add_argument('-d', '--document', action='store_true', |
| 247 |
|
help="indicates the 'label' is a document prefix") |
| 248 |
|
|
| 249 |
|
|
| 250 |
|
def _import(subs, shared): |
| 251 |
|
"""Configure the `doorstop import` subparser.""" |
| 252 |
|
info = "import an existing document or item" |
| 253 |
|
sub = subs.add_parser('import', description=info.capitalize() + '.', |
| 254 |
|
help=info, **shared) |
| 255 |
|
sub.add_argument('path', nargs='?', |
| 256 |
|
help="path to previously exported document file") |
| 257 |
|
sub.add_argument('prefix', nargs='?', help="prefix of document for import") |
| 258 |
|
group = sub.add_mutually_exclusive_group() |
| 259 |
|
group.add_argument('-d', '--document', nargs=2, metavar='ARG', |
| 260 |
|
help="import an existing document by: PREFIX PATH") |
| 261 |
|
group.add_argument('-i', '--item', nargs=2, metavar='ARG', |
| 262 |
|
help="import an existing item by: PREFIX UID") |
| 263 |
|
sub.add_argument('-p', '--parent', metavar='PREFIX', |
| 264 |
|
help="parent document prefix for imported document") |
| 265 |
|
sub.add_argument('-a', '--attrs', metavar='DICT', |
| 266 |
|
help="dictionary of item attributes to import") |
| 267 |
|
sub.add_argument('-m', '--map', metavar='DICT', |