This repository has been archived by the owner on Jul 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
target_prompt
Marcel Kloubert edited this page Jun 5, 2017
·
21 revisions
Asks the user for a list of settings that will be applied to one or more other targets.
The following example lets the user input an username and password and writes these values to user
and password
settings of FTP server template
.
{
"deploy": {
"targets": [
{
"type": "prompt",
"name": "FTP server",
"prompts": [
{
"text": "Please enter your username",
"properties": [ "user" ],
"defaultValue": "/my_package_files",
"cache": true,
"showAlways": true
},
{
"valuePlaceHolder": "Please enter the password for '${user}'",
"isPassword": true,
"properties": [ "password" ],
"cache": true
}
],
"targets": [ "FTP server template" ]
},
{
"name": "FTP server template",
"type": "ftp",
"isHidden": true,
"user": "<NO NEED TO SET: This is done by 1st prompt of 'FTP server' target>",
"password": "<NO NEED TO SET: This is done by 2nd prompt of 'FTP server' target>"
}
]
}
}
Name | Description |
---|---|
prompts |
One or more prompt entry. |
targets |
One or more target name to deploy to. |
Name | Description |
---|---|
cache |
Save value in cache or not. Default: (false)
|
defaultValue |
The initial value. |
description |
A description for the entry. |
ignoreFocusOut |
Set to (true) to keep the input box open when focus moves to another part of the editor or to another window. Default: (true)
|
isPassword |
Input value is secret / a password. Default: (false)
|
properties |
A list of one or more property names inside the target where to write the value to. |
showAlways |
Always show input box even if cached. Default: (false)
|
text |
The text for the input box. |
type |
The value type. Default: string
|
validator |
The path to a script that validates an user input. |
validatorOptions |
The options for the validator script. |
valuePlaceHolder |
The placeholder for the input box. |
Name | Description |
---|---|
``, string
|
Does no conversion. |
bool , boolean
|
Convert to a boolean value. |
file |
Loads data from a file and parses it as JSON string. |
float , number
|
Convert to a number / float value. |
int , integer
|
Convert to an integer value. |
json , object , obj
|
Parses a value as JSON string. |
A script must have a public / exported validate
function:
exports.validate = function(args) {
// check for value in
// args.value
// return (true) for valid
// or (false) for invalid
// (true) is the default value
}