Commit 0f4d622
committed
--procs takes * nargs using optional_procs choices
Thank you for the feedback here @jph00.
I couldn't quite figure out how to get --procs to work with a tuple.
But using Param(.., nargs="*", choices=optional_procs())="black_format" seems to get something more user-friendly for the command line.
Here are some examples using `raise Exception(L(procs))` in the method to debug it.
```
> nbdev_export -h
usage: nbdev_export [-h] [--path PATH] [--symlinks] [--file_glob FILE_GLOB] [--file_re FILE_RE] [--folder_re FOLDER_RE] [--skip_file_glob SKIP_FILE_GLOB] [--skip_file_re SKIP_FILE_RE] [--skip_folder_re SKIP_FOLDER_RE] [--procs [{black_format,scrub_magics} [{black_format,scrub_magics} ...]]]
...
--procs [{black_format,scrub_magics} [{black_format,scrub_magics} ...]] tokens naming the export processors to use. (default: black_format)
> nbdev_export
Exception: ['black_format']
> nbdev_export --procs
> Exception: []
> nbdev_export --procs scrub_magics black_format
Exception: ['scrub_magics', 'black_format']
> nbdev_export --procs black_format
Exception: ['black_format']
> nbdev_export --procs scrub_magics
Exception: ['scrub_magics']
> nbdev_export --procs black_forma
usage: nbdev_export [-h] [--path PATH] [--symlinks] [--file_glob FILE_GLOB] [--file_re FILE_RE] [--folder_re FOLDER_RE] [--skip_file_glob SKIP_FILE_GLOB] [--skip_file_re SKIP_FILE_RE] [--skip_folder_re SKIP_FOLDER_RE] [--procs [{black_format,scrub_magics} [{black_format,scrub_magics} ...]]]
nbdev_export: error: argument --procs: invalid choice: 'black_forma' (choose from 'black_format', 'scrub_magics')
> nbdev_export --procs black_forma scrub_magics
usage: nbdev_export [-h] [--path PATH] [--symlinks] [--file_glob FILE_GLOB] [--file_re FILE_RE] [--folder_re FOLDER_RE] [--skip_file_glob SKIP_FILE_GLOB] [--skip_file_re SKIP_FILE_RE] [--skip_folder_re SKIP_FOLDER_RE] [--procs [{black_format,scrub_magics} [{black_format,scrub_magics} ...]]]
nbdev_export: error: argument --procs: invalid choice: 'black_forma' (choose from 'black_format', 'scrub_magics')
> nbdev_export --procs scrub_magics barst
usage: nbdev_export [-h] [--path PATH] [--symlinks] [--file_glob FILE_GLOB] [--file_re FILE_RE] [--folder_re FOLDER_RE] [--skip_file_glob SKIP_FILE_GLOB] [--skip_file_re SKIP_FILE_RE] [--skip_folder_re SKIP_FOLDER_RE] [--procs [{black_format,scrub_magics} [{black_format,scrub_magics} ...]]]
nbdev_export: error: argument --procs: invalid choice: 'barst' (choose from 'black_format', 'scrub_magics')
```1 parent ca1d792 commit 0f4d622
2 files changed
+10
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | 130 | | |
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
137 | | - | |
| 134 | + | |
138 | 135 | | |
139 | 136 | | |
140 | 137 | | |
141 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
142 | 141 | | |
143 | 142 | | |
144 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
351 | | - | |
352 | 350 | | |
353 | 351 | | |
354 | 352 | | |
355 | 353 | | |
356 | 354 | | |
357 | | - | |
| 355 | + | |
358 | 356 | | |
359 | 357 | | |
360 | 358 | | |
361 | | - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
373 | | - | |
| 372 | + | |
374 | 373 | | |
375 | | - | |
| 374 | + | |
376 | 375 | | |
377 | 376 | | |
378 | 377 | | |
| |||
0 commit comments