diff --git a/schemas/bashly.json b/schemas/bashly.json index 441c42e7..fc996887 100644 --- a/schemas/bashly.json +++ b/schemas/bashly.json @@ -56,7 +56,7 @@ "title": "allowed", "description": "Valid values of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#allowed", "type": "array", - "minLength": 1, + "minItems": 1, "uniqueItems": true, "items": { "description": "A valid value of the current positional argument", @@ -193,7 +193,7 @@ "title": "allowed", "description": "Valid values of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#allowed", "type": "array", - "minLength": 1, + "minItems": 1, "uniqueItems": true, "items": { "description": "A valid value of the current positional argument", @@ -208,7 +208,7 @@ "title": "conflicts", "description": "Mutually exclusive flags of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#conflicts", "type": "array", - "minLength": 1, + "minItems": 1, "uniqueItems": true, "items": { "description": "The long form of the required flag", @@ -223,7 +223,7 @@ "title": "needs", "description": "Additional flags required by the current flag\nhttps://bashly.dannyb.co/configuration/flag/#needs", "type": "array", - "minLength": 1, + "minItems": 1, "uniqueItems": true, "items": { "description": "The long form of the required flag", @@ -238,7 +238,7 @@ "title": "completions", "description": "Completions of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#completions", "type": "array", - "minLength": 1, + "minItems": 1, "uniqueItems": true, "items": { "description": "A completion of the current flag", @@ -349,7 +349,7 @@ "title": "allowed", "description": "Valid values of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#allowed", "type": "array", - "minLength": 1, + "minItems": 1, "uniqueItems": true, "items": { "description": "A valid value of the current environment variable", @@ -380,6 +380,50 @@ }, "additionalProperties": false }, + "variable": { + "title": "variable", + "description": "A global bash variable\nhttps://bashly.dannyb.co/configuration/command/#variables", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "title": "name", + "description": "A name for the current variable", + "type": "string", + "minLength": 1, + "examples": [ + "output_dir" + ] + }, + "value": { + "title": "value", + "description": "A value for the current variable", + "examples": [ + "output_dir", + [ + "development", + "production" + ], + { + "verbosity": 3, + "debug": true + } + ] + } + }, + "patternProperties": { + "^x_.": { + "title": "custom property", + "description": "A custom property of any type", + "examples": [ + "Anything" + ] + } + }, + "additionalProperties": false + }, "name-property": { "title": "name", "description": "A name of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#name", @@ -430,8 +474,8 @@ "title": "args", "description": "Arguments of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#args", "type": "array", - "uniqueItems": true, "minItems": 1, + "uniqueItems": true, "items": { "$ref": "#/definitions/argument" } @@ -440,8 +484,8 @@ "title": "flags", "description": "Flags of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#flags", "type": "array", - "uniqueItems": true, "minItems": 1, + "uniqueItems": true, "items": { "$ref": "#/definitions/flag" } @@ -450,6 +494,7 @@ "title": "commands", "description": "Subcommands of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#commands", "type": "array", + "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/definitions/command-property" @@ -485,11 +530,22 @@ "title": "environment variables", "description": "Environment variables of the current application\nhttps://bashly.dannyb.co/configuration/environment-variable/#environment-variable", "type": "array", + "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/definitions/environment-variable" } }, + "variables-property": { + "title": "variables", + "description": "Bash variables for the current application\nhttps://bashly.dannyb.co/configuration/command/#variables", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/variable" + } + }, "examples-property": { "title": "examples", "oneOf": [ @@ -583,7 +639,7 @@ "title": "completions", "description": "Completions of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#completions", "type": "array", - "minLength": 1, + "minItems": 1, "uniqueItems": true, "items": { "description": "A completion of the current script or sub-command", @@ -647,7 +703,7 @@ { "description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", "type": "array", - "minLength": 1, + "minItems": 1, "uniqueItems": true, "items": { "description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", @@ -806,6 +862,9 @@ "environment_variables": { "$ref": "#/definitions/environment-variables-property" }, + "variables": { + "$ref": "#/definitions/variables-property" + }, "examples": { "$ref": "#/definitions/examples-property" }, @@ -880,6 +939,9 @@ "environment_variables": { "$ref": "#/definitions/environment-variables-property" }, + "variables": { + "$ref": "#/definitions/variables-property" + }, "examples": { "$ref": "#/definitions/examples-property" }, diff --git a/support/schema/bashly.yml b/support/schema/bashly.yml index 37fd6a01..5bad1e4a 100644 --- a/support/schema/bashly.yml +++ b/support/schema/bashly.yml @@ -53,7 +53,7 @@ definitions: Valid values of the current positional argument https://bashly.dannyb.co/configuration/argument/#allowed type: array - minLength: 1 + minItems: 1 uniqueItems: true items: description: A valid value of the current positional argument @@ -172,7 +172,7 @@ definitions: Valid values of the current flag https://bashly.dannyb.co/configuration/flag/#allowed type: array - minLength: 1 + minItems: 1 uniqueItems: true items: description: A valid value of the current positional argument @@ -186,7 +186,7 @@ definitions: Mutually exclusive flags of the current flag https://bashly.dannyb.co/configuration/flag/#conflicts type: array - minLength: 1 + minItems: 1 uniqueItems: true items: description: The long form of the required flag @@ -200,7 +200,7 @@ definitions: Additional flags required by the current flag https://bashly.dannyb.co/configuration/flag/#needs type: array - minLength: 1 + minItems: 1 uniqueItems: true items: description: The long form of the required flag @@ -214,7 +214,7 @@ definitions: Completions of the current flag https://bashly.dannyb.co/configuration/flag/#completions type: array - minLength: 1 + minItems: 1 uniqueItems: true items: description: A completion of the current flag @@ -317,7 +317,7 @@ definitions: Valid values of the current environment variable https://bashly.dannyb.co/configuration/environment-variable/#allowed type: array - minLength: 1 + minItems: 1 uniqueItems: true items: description: A valid value of the current environment variable @@ -335,6 +335,31 @@ definitions: - ~/config.ini patternProperties: *custom-properties additionalProperties: false + variable: + title: variable + description: |- + A global bash variable + https://bashly.dannyb.co/configuration/command/#variables + type: object + required: + - name + properties: + name: + title: name + description: A name for the current variable + type: string + minLength: 1 + examples: + - output_dir + value: + title: value + description: A value for the current variable + examples: + - output_dir + - [development, production] + - { verbosity: 3, debug: true } + patternProperties: *custom-properties + additionalProperties: false name-property: title: name description: |- @@ -382,8 +407,8 @@ definitions: Arguments of the current script or sub-command https://bashly.dannyb.co/configuration/command/#args type: array - uniqueItems: true minItems: 1 + uniqueItems: true items: $ref: '#/definitions/argument' flags-property: @@ -392,8 +417,8 @@ definitions: Flags of the current script or sub-command https://bashly.dannyb.co/configuration/command/#flags type: array - uniqueItems: true minItems: 1 + uniqueItems: true items: $ref: '#/definitions/flag' commands-property: @@ -402,6 +427,7 @@ definitions: Subcommands of the current script or sub-command https://bashly.dannyb.co/configuration/command/#commands type: array + minItems: 1 uniqueItems: true items: $ref: '#/definitions/command-property' @@ -432,9 +458,20 @@ definitions: Environment variables of the current application https://bashly.dannyb.co/configuration/environment-variable/#environment-variable type: array + minItems: 1 uniqueItems: true items: $ref: '#/definitions/environment-variable' + variables-property: + title: variables + description: |- + Bash variables for the current application + https://bashly.dannyb.co/configuration/command/#variables + type: array + minItems: 1 + uniqueItems: true + items: + $ref: '#/definitions/variable' examples-property: title: examples oneOf: @@ -520,7 +557,7 @@ definitions: Completions of the current script or sub-command https://bashly.dannyb.co/configuration/command/#completions type: array - minLength: 1 + minItems: 1 uniqueItems: true items: description: A completion of the current script or sub-command @@ -583,7 +620,7 @@ definitions: Dependencies of the current script or sub-command https://bashly.dannyb.co/configuration/dependency/#dependency type: array - minLength: 1 + minItems: 1 uniqueItems: true items: description: |- @@ -708,6 +745,8 @@ definitions: $ref: '#/definitions/sub-command-default-property' environment_variables: $ref: '#/definitions/environment-variables-property' + variables: + $ref: '#/definitions/variables-property' examples: $ref: '#/definitions/examples-property' footer: @@ -754,6 +793,8 @@ properties: $ref: '#/definitions/root-version-property' environment_variables: $ref: '#/definitions/environment-variables-property' + variables: + $ref: '#/definitions/variables-property' examples: $ref: '#/definitions/examples-property' footer: