IDC uses a custom version of drush_choice() and drush_choice_multiple() to add some DX Features on top of them.
For Multiple Choice lists, developers can select / deselect multiple items at once in 2 ways (besides, of course, the normal selection by entering just one value in the CLI).
- Comma-Separated Values
- Item ranges (delimited by "[x-y]")
- CSV containing item ranges.
Comma-Separated Values
Comma-separated values can be used for both selecting AND deselecting elements of a list. When a value is read from a CSV list, it's select status will be just changed.
Example 1 (Selecting elements):
Imagine a list of 10 items, (1 to 10). To select the items 3, 4, 6, 8 and 9 all at once, simply enter:
3,4,6,8,9
and press enter. The list will reload with those items selected.
Example 2 (Selecting AND Deselecting elements):
Imagine a list of 10 items, (1 to 10), where items 5, 6 and 8 are selected.
Entering in the command line:
1,2,3,5,6
Would select the items not selected yet, and deselect the ones that were selected. This is, the list will reload with the following items selected:
1,2,3
Item ranges (delimited by "[x-y]")
Item ranges can be used only to select elements of a list, but not to deselect items. This means that whenever a value already selected is included in a range of items, it'll stay selected when the list reloads.
Example 1 (Selecting a list of values)
Imagine a list of 50 items, (1 to 50). To select the items 20 to 40 all at once, simply enter:
[20-40]
Press enter, and the list will reload with all the items from 20 to 40 selected.
CSV containing item ranges.
This approach allows to enter a list of comma-separated values, in which each value can be either a simple integer that matches one of the options of the list, or a range of values.
Example 1 (Selecting values with ranges and single items)
Imagine a list of 50 items, (1 to 10). To select the items 2, 3, 4, 5, 8 and 9, all at once, simply enter:
[2-5],8,9
And press enter. The list will reload with all the mentioned items selected.