Skip to content

Commit

Permalink
feat(lib): add input WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Aug 28, 2024
1 parent bc4a393 commit bba72ab
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lib/input.ai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
version: 0.1.0
type: lib
description: |-
This script will wait for user input.
tag:
- user
- input
- lib
input:
- inputType # The input type: confirm, select, number, list, input, password
- question # the message to show to the user
- value # the initial(default) value of the input
output:
type: 'object'
properties:
question: {type: 'string'}
answer: {type: 'string'}
---
- !fn |-
toText(value) {
if (value == null) {
return 'null';
}
if (typeof this.format === 'function') {
return this.format(value);
}
const t = typeof value;
switch (t) {
case 'boolean':
return value ? 'yes' : 'no';
}
return value
}
- $set:
result: $consoleInput
- $echo: "result.answer"

0 comments on commit bba72ab

Please sign in to comment.