Skip to content

Commit 136f36a

Browse files
committed
feat: Swap all selects and multiselects to autocomplete
1 parent ee964b2 commit 136f36a

11 files changed

Lines changed: 20 additions & 15 deletions

File tree

lib/actions/add-model/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async function * gatherModelProperty (dataDomains) {
9494
initial: () => `${_.upperFirst(_.lowerCase(propertyDetails.key))}`
9595
},
9696
{
97-
type: 'select',
97+
type: 'autocomplete',
9898
name: 'typeHint',
9999
message: 'Data type',
100100
choices: Scaffold.ModelTypes({ domainRestriction: dataDomains }).map(t => {

lib/actions/add-role/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ async function selectRoles (blueprint) {
3131
}
3232

3333
const selectedRoles = await ask({
34-
type: 'multiselect',
34+
type: 'autocomplete',
35+
multiple: true,
3536
message: 'Roles this new role is a member of',
3637
hint: '(Use <space> to select, <return> to submit)',
3738
sort: true,

lib/actions/add-search-doc/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function chooseLabelField (properties) {
5353
})
5454

5555
const title = await ask({
56-
type: 'select',
56+
type: 'autocomplete',
5757
message: 'Select title field',
5858
choices: fields.map(f => f.title)
5959
})
@@ -71,7 +71,8 @@ async function chooseDescriptionFields (properties) {
7171
})
7272

7373
const description = await ask({
74-
type: 'multiselect',
74+
type: 'autocomplete',
75+
multiple: true,
7576
message: 'Select description fields',
7677
choices: fields.map(f => f.title)
7778
})
@@ -128,7 +129,7 @@ async function * gatherLaunch (stateMachines) {
128129
}
129130

130131
const stateMachine = await ask({
131-
type: 'select',
132+
type: 'autocomplete',
132133
message: 'State machine to launch',
133134
choices: stateMachines
134135
})

lib/actions/add-state-machine/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async function addStateMachine (options) {
5454

5555
async function selectMachine () {
5656
const machine = await ask({
57-
type: 'select',
57+
type: 'autocomplete',
5858
message: 'State machine to create',
5959
choices: Scaffold.StateMachines()
6060
})
@@ -75,7 +75,7 @@ async function selectForm (blueprint) {
7575
}
7676

7777
const formName = await ask({
78-
type: 'select',
78+
type: 'autocomplete',
7979
message: 'Update form',
8080
choices: forms.map(m => m.name)
8181
})

lib/actions/new-blueprint/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ async function domainDetails (blueprintInfo, profile) {
8989
.map(d => d.name)
9090

9191
const chosenDomains = await ask({
92-
type: 'multiselect',
92+
type: 'autocomplete',
93+
multiple: true,
9394
message: 'What kind of data will this blueprint work with?',
9495
initial: defaultDomains,
9596
choices: domains.map(d => {
@@ -149,7 +150,7 @@ async function buildDetails (blueprintInfo, profile) {
149150
initial: true
150151
})
151152
blueprintInfo.ciProfile = await ask({
152-
type: 'select',
153+
type: 'autocomplete',
153154
message: 'CI Profile',
154155
initial: 'travis',
155156
choices: [

lib/actions/util/ask.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ async function ask (question) {
77
if (!question.name) {
88
question.name = 'name'
99
}
10-
if (question.type === 'multiselect' && !question.hint) {
10+
if (question.multiple && !question.hint) {
1111
question.hint = '(Use <space> to select, <return> to submit)'
1212
}
1313
const selection = await prompt(question)

lib/actions/util/choose-categories.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ async function chooseCategories (blueprint) {
1919
}
2020

2121
const cats = await ask({
22-
type: 'multiselect',
22+
type: 'autocomplete',
23+
multiple: true,
2324
message: 'Select categories',
2425
choices: categories
2526
})

lib/actions/util/choose-category.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function chooseCategory (blueprint, suggestion) {
1818
}
1919

2020
const cat = await ask({
21-
type: 'select',
21+
type: 'autocomplete',
2222
message: 'Select a category',
2323
choices: categories
2424
})

lib/actions/util/choose-roles.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ async function chooseRoles (blueprint, suggested = '$authenticated') {
1515
}
1616

1717
const cats = await ask({
18-
type: 'multiselect',
18+
type: 'autocomplete',
19+
multiple: true,
1920
message: 'Select roles',
2021
choices: [
2122
...roles.map(r => r.label)

lib/actions/util/select-internal-model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function selectInternalModel (blueprint) {
1515
}
1616

1717
const modelName = await ask({
18-
type: 'select',
18+
type: 'autocomplete',
1919
message: 'Model to scaffold against',
2020
choices: models.map(m => m.name)
2121
})

0 commit comments

Comments
 (0)