Add confirmation component
- New ConfirmationInput component - Add missing native resource config for templates. - Add sample "component confirmation", use flag --no to switch default from yes to no. - Fixes #366
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"resources": {
|
||||
"includes": [
|
||||
{
|
||||
"pattern": "org/springframework/shell/component/.*.stg"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// message
|
||||
message(model) ::= <%
|
||||
<if(model.message && model.hasMessageLevelError)>
|
||||
<(">>>"); format="level-error"> <model.message; format="level-error">
|
||||
<elseif(model.message && model.hasMessageLevelWarn)>
|
||||
<(">>"); format="level-warn"> <model.message; format="level-warn">
|
||||
<elseif(model.message && model.hasMessageLevelInfo)>
|
||||
<(">"); format="level-info"> <model.message; format="level-info">
|
||||
<endif>
|
||||
%>
|
||||
|
||||
// info section after '? xxx'
|
||||
info(model) ::= <%
|
||||
<if(model.defaultValue)>
|
||||
<("(Y/n)"); format="item-disabled">
|
||||
<else>
|
||||
<("(y/N)"); format="item-disabled">
|
||||
<endif>
|
||||
%>
|
||||
|
||||
// start '? xxx' shows both running and result
|
||||
question_name(model) ::= <<
|
||||
<("?"); format="list-value"> <model.name; format="title">
|
||||
>>
|
||||
|
||||
// component result
|
||||
result(model) ::= <<
|
||||
<question_name(model)> <model.resultValue; format="value">
|
||||
>>
|
||||
|
||||
// component is running
|
||||
running(model) ::= <<
|
||||
<question_name(model)> <info(model)>
|
||||
<message(model)>
|
||||
>>
|
||||
|
||||
// main
|
||||
main(model) ::= <<
|
||||
<if(model.resultValue)><result(model)><else><running(model)><endif>
|
||||
>>
|
||||
Reference in New Issue
Block a user