2020-05-02 22:06:04 +02:00
|
|
|
# YunoHost Arguments Format
|
|
|
|
|
|
|
|
In YunoHost application developpement there are several places where you end up
|
2020-05-02 22:10:33 +02:00
|
|
|
writting questions for your user like in the `manifest.json/toml`, the
|
|
|
|
`config_panel.json/toml` or `actions.json/toml`.
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
This page documents this format and all available kind of questions you can ask
|
|
|
|
your user. Unless it's stated otherwise, this format applies to everyplace it's
|
2020-05-02 22:10:33 +02:00
|
|
|
usable (for now: installation arguments in `manifest.json/toml`,
|
|
|
|
`config_panel.json/toml` and `actions.json/toml`)
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
## YunoHost arguments general format
|
|
|
|
|
|
|
|
The general format for an argument looks like this in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "one_of_the_available_type"
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
help.en = "some help text in english" # optional
|
|
|
|
help.fr = "some help text in french" # optional
|
|
|
|
example = "an example value" # optional
|
|
|
|
default = "some stuff" # optional, not available for all types
|
2020-05-02 22:13:22 +02:00
|
|
|
optional = true # optional, will skip if not answered
|
2020-05-02 22:06:04 +02:00
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
2020-05-02 22:11:36 +02:00
|
|
|
"type": "one_of_the_available_type", // "sting" is not specified
|
2020-05-02 22:06:04 +02:00
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
},
|
|
|
|
"help": {
|
|
|
|
"en": "some help text in english",
|
|
|
|
"fr": "some help text in french"
|
|
|
|
}
|
2020-05-02 22:11:36 +02:00
|
|
|
"default", "some stuff", // optional, not available for all types
|
2020-05-02 22:13:22 +02:00
|
|
|
"example": "an example value", // optional
|
2020-05-02 22:14:19 +02:00
|
|
|
"optional": true, // optional, will skip if not answered
|
2020-05-02 22:06:04 +02:00
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
## All avaiable types
|
|
|
|
|
|
|
|
### string
|
|
|
|
|
|
|
|
This one is the simpliest one and is the default type if you don't specify one.
|
|
|
|
|
|
|
|
Example in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "string" # optional
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
example = "an example value" # optional
|
|
|
|
default = "some stuff" # optional
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
2020-05-02 22:11:36 +02:00
|
|
|
"type": "string", // optional
|
2020-05-02 22:06:04 +02:00
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
},
|
2020-05-02 22:11:36 +02:00
|
|
|
"default": "some stuff", // optional
|
2020-05-02 22:06:04 +02:00
|
|
|
"example": "an example value"
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### string with choices
|
|
|
|
|
|
|
|
Like string except the user needs to chose in a list of specifics strings.
|
|
|
|
|
|
|
|
Example in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "string"
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
example = "an example value" # optional
|
|
|
|
choices = ["fr", "en"]
|
|
|
|
default = "en" # optional
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
|
|
|
"type": "string",
|
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
},
|
|
|
|
"example": "an example value",
|
|
|
|
"choices": ["fr", "en"],
|
2020-05-02 22:11:36 +02:00
|
|
|
"default": "en" // optional
|
2020-05-02 22:06:04 +02:00
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### domain
|
|
|
|
|
|
|
|
This type will ask the user to chose one of the domains of their YunoHost instance.
|
|
|
|
|
|
|
|
Example in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "domain"
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
|
|
|
"type": "domain",
|
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### Path
|
|
|
|
|
|
|
|
This type will ask the user to chose an url path (generally to happen it to a
|
|
|
|
domain) like "/path/to/my/app"
|
|
|
|
|
|
|
|
Example in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "path"
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
default = "/my_app"
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
|
|
|
"type": "path",
|
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
},
|
|
|
|
"default": "/my_app"
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### User
|
|
|
|
|
|
|
|
This type will ask the user to select a user in the list of users in their
|
|
|
|
YunoHost installation. Generally this is used to select who is going to be the
|
|
|
|
admin or who is going to have access to this application.
|
|
|
|
|
|
|
|
Example in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "user"
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
|
|
|
"type": "user",
|
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### Password
|
|
|
|
|
|
|
|
This type will ask the user to input a password. This is generally used to
|
|
|
|
input the password for creating an account on the application.
|
|
|
|
|
2020-05-02 22:19:37 +02:00
|
|
|
In CLI it will behave like any password query and won't print any character on
|
|
|
|
type (not "\*\*\*...") for security reasons.
|
|
|
|
|
2020-05-02 22:06:04 +02:00
|
|
|
Example in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "password"
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
|
|
|
"type": "password",
|
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### Boolean
|
|
|
|
|
|
|
|
This type will ask the user to answer true or false to a question.
|
|
|
|
|
|
|
|
Example in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "boolean"
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
default = true
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
|
|
|
"type": "boolean",
|
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
},
|
|
|
|
"default": true
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### App
|
|
|
|
|
|
|
|
This type will ask the user to select an application in the list of installed
|
|
|
|
application on their YunoHost.
|
|
|
|
|
|
|
|
Example in toml:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "app"
|
|
|
|
ask.en = "the question in english"
|
|
|
|
ask.fr = "the question in french"
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
|
|
|
"type": "app",
|
|
|
|
"ask": {
|
|
|
|
"en": "the question in english",
|
|
|
|
"fr": "the question in french"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### display_text
|
|
|
|
|
|
|
|
This is a special type that allows the application packager to write some text
|
|
|
|
that will be simply displayed. This is useful to provide more context.
|
|
|
|
|
|
|
|
```toml
|
|
|
|
[maybe.some.stuff.before.the_name]
|
|
|
|
type = "display_text"
|
|
|
|
ask.en = "the text in english"
|
|
|
|
ask.fr = "the text in french"
|
|
|
|
```
|
|
|
|
|
2020-05-02 22:10:33 +02:00
|
|
|
And in json:
|
2020-05-02 22:06:04 +02:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"name": "the_name",
|
|
|
|
"type": "display_text",
|
|
|
|
"ask": {
|
|
|
|
"en": "the text in english",
|
|
|
|
"fr": "the text in french"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
```
|