Skip to content

JSON Executable

NebelFox edited this page Feb 19, 2022 · 9 revisions

Common properties

  • name: mandatory string. Executable identifier, unique within the containing namespace.
  • brief: optional string. Short info about the executable. Is displayed next to the name in the help message of the containing namespace.
  • description: optional string(single-line) or string[](multiline). Is displayed in the executable help message.

Example:

{
    "commands": [
        {
            "name": "foo",
            "brief": "does nothing",
            "description": "single-line description"
        },
        {
            "name": "bar",
            "description": [
                "first line of a multiline description",
                "second line of a multiline description"
            ]
        }
    ]
}

Any executable is either a Command or a Namespace.

Namespace:

commands property - the same as in the box. Allows nesting.
Example:

{
    "commands": [
        {
            "name": "command"
        },
        {
            "name": "namespace",
            "commands": [
                {
                    "name": "nested-command"
                },
                {
                    "name": "nested-namespace",
                    "commands": [
                        {
                            "name": "even-more-nested-command"
                        }
                    ]
                }
            ]
        }
    ]
}

Command:

parameters or params property - a string(single parameter) or string[](multiple parameters) each defining a parameter.
Example:

{
    "commands": [
        {
            "name": "foo",
            "parameters": "[bar:int...]"
        },
        {
            "name": "baz",
            "params": [
                "mandatory",
                "[optional:int]",
                "collective:float..."
            ]
        }
    ]
}

Note. If neither commands nor parameters/params property specified, the executable is interpreted as a Command. If both specified - the executable is interpreted as a Namespace, and the parameters/params property is ignored.

Note. A single string may be used instead of an executable object. It is interpreted as a Command with just a name, set to the value of this string. Examples of usage could be found here

Clone this wiki locally