diff --git a/schemas/bashly.json b/schemas/bashly.json index 345a037d..73d3d86e 100644 --- a/schemas/bashly.json +++ b/schemas/bashly.json @@ -1,908 +1,945 @@ { - "$schema": "http://json-schema.org/draft-07/schema", - "definitions": { - "custom-properties": { - "patternProperties": { - "^x_.": { - "title": "custom property", - "description": "A custom property of any type", - "examples": [ - "Anything" - ] - } - } + "$schema": "http://json-schema.org/draft-07/schema", + "definitions": { + "argument": { + "title": "argument", + "description": "A positional argument of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/argument/", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "title": "name", + "description": "A name of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#name", + "type": "string", + "minLength": 1, + "examples": [ + "user" + ] }, - "argument": { - "title": "argument", - "description": "A positional argument of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/argument/", - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "title": "name", - "description": "A name of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#name", - "type": "string", - "minLength": 1, - "examples": [ - "user" - ] - }, - "help": { - "title": "help", - "description": "A description of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#help", - "type": "string", - "minLength": 1, - "examples": [ - "AWS Username" - ] - }, - "default": { - "title": "default", - "description": "A default value of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#default", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - } - ], - "examples": [ - "*.jpg" - ] - }, - "required": { - "title": "required", - "description": "Whether the current positional argument is required\nhttps://bashly.dannyb.co/configuration/argument/#required", - "type": "boolean", - "default": true - }, - "allowed": { - "title": "allowed", - "description": "Valid values of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#allowed", - "type": "array", - "minLength": 1, - "uniqueItems": true, - "items": { - "description": "A valid value of the current positional argument", - "type": "string", - "minLength": 1, - "examples": [ - "eu" - ] - } - }, - "repeatable": { - "title": "repeatable", - "description": "Whether the current positional argument can be repeated\nhttps://bashly.dannyb.co/configuration/argument/#repeatable", - "type": "boolean", - "default": false - }, - "validate": { - "title": "validate", - "description": "A validation function of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#validate", - "type": "string", - "examples": [ - "file_exists", - "dir_exists", - "integer", - "non_empty" - ] - }, - "unique": { - "title": "unique", - "description": "Whether the current positional argument is unique\nhttps://bashly.dannyb.co/configuration/argument/#unique", - "type": "boolean", - "default": false - } - }, - "dependencies": { - "unique": { - "properties": { - "repeatable": { - "const": true - } - } - } - }, - "$ref": "#/definitions/custom-properties", - "additionalProperties": false - }, - "flag": { - "title": "flag", - "description": "A flag of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/flag/", - "type": "object", - "anyOf": [ - { - "required": [ - "long" - ] - }, - { - "required": [ - "short" - ] - } - ], - "properties": { - "long": { - "title": "long", - "description": "A long form of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#long", - "type": "string", - "pattern": "^--", - "examples": [ - "--ssh" - ] - }, - "short": { - "title": "short", - "description": "A short form of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#short", - "type": "string", - "pattern": "^-[^-]", - "examples": [ - "-s" - ] - }, - "help": { - "title": "help", - "description": "A description of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#help", - "type": "string", - "minLength": 1, - "examples": [ - "Clone using SSH" - ] - }, - "arg": { - "title": "arg", - "description": "An argument name of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#arg", - "type": "string", - "minLength": 1, - "examples": [ - "user" - ] - }, - "default": { - "title": "default", - "description": "A default value of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#default", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - } - ], - "examples": [ - "*.jpg" - ] - }, - "required": { - "title": "required", - "description": "Whether the current flag is required\nhttps://bashly.dannyb.co/configuration/flag/#required", - "type": "boolean", - "default": true - }, - "allowed": { - "title": "allowed", - "description": "Valid values of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#allowed", - "type": "array", - "minLength": 1, - "uniqueItems": true, - "items": { - "description": "A valid value of the current positional argument", - "type": "string", - "minLength": 1, - "examples": [ - "user" - ] - } - }, - "conflicts": { - "title": "conflicts", - "description": "Mutually exclusive flags of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#conflicts", - "type": "array", - "minLength": 1, - "uniqueItems": true, - "items": { - "description": "A mutually exclusive flag of the current flag", - "type": "string", - "minLength": 1, - "examples": [ - "--no-cache" - ] - } - }, - "completions": { - "title": "completions", - "description": "Completions of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#completions", - "type": "array", - "minLength": 1, - "uniqueItems": true, - "items": { - "description": "A completion of the current flag", - "type": "string", - "minLength": 1 - } - }, - "private": { - "title": "private", - "description": "Whether the current flag is hidden from help\nhttps://bashly.dannyb.co/configuration/flag/#private", - "type": "boolean", - "default": false - }, - "repeatable": { - "title": "repeatable", - "description": "Whether the current flag can be repeated\nhttps://bashly.dannyb.co/configuration/flag/#repeatable", - "type": "boolean", - "default": false - }, - "validate": { - "title": "validate", - "description": "A validation function of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#validate", - "type": "string", - "examples": [ - "file_exists", - "dir_exists", - "integer", - "non_empty" - ] - }, - "unique": { - "title": "unique", - "description": "Whether the current flag is unique\nhttps://bashly.dannyb.co/configuration/flag/#unique", - "type": "boolean", - "default": false - } - }, - "dependencies": { - "unique": { - "properties": { - "repeatable": { - "const": true - } - } - } + "help": { + "title": "help", + "description": "A description of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#help", + "type": "string", + "minLength": 1, + "examples": [ + "AWS Username" + ] + }, + "default": { + "title": "default", + "description": "A default value of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#default", + "oneOf": [ + { + "type": "string" }, - "$ref": "#/definitions/custom-properties", - "additionalProperties": false - }, - "name-property": { - "title": "name", - "description": "A name of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#name", - "type": "string", - "minLength": 1, - "examples": [ - "source" - ] - }, - "sub-command-alias-property": { - "$comment": "'sub-command-' prefix is used as this property is marked with 'Sub-Commands Only' badge", - "title": "alias", - "oneOf": [ - { - "description": "An alias of the current sub-command\nhttps://bashly.dannyb.co/configuration/command/#alias", - "type": "string", - "minLength": 1, - "examples": [ - "s" - ] - }, - { - "description": "Aliases of the current sub-command\nhttps://bashly.dannyb.co/configuration/command/#alias", - "type": "array", - "minItems": 1, - "uniqueItems": true, - "items": { - "description": "An alias of the current sub-command", - "type": "string", - "minLength": 1, - "examples": [ - "s" - ] - } - } - ] - }, - "help-property": { - "title": "help", - "description": "A description of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#help", + { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + } + ], + "examples": [ + "*.jpg" + ] + }, + "required": { + "title": "required", + "description": "Whether the current positional argument is required\nhttps://bashly.dannyb.co/configuration/argument/#required", + "type": "boolean", + "default": true + }, + "allowed": { + "title": "allowed", + "description": "Valid values of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#allowed", + "type": "array", + "minLength": 1, + "uniqueItems": true, + "items": { + "description": "A valid value of the current positional argument", "type": "string", "minLength": 1, "examples": [ - "URL to download from" + "eu" ] - }, - "args-property": { - "title": "args", - "description": "Arguments of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#args", - "type": "array", - "uniqueItems": true, - "minItems": 1, - "items": { - "$ref": "#/definitions/argument" - } - }, - "flags-property": { - "title": "flags", - "description": "Flags of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#flags", - "type": "array", - "uniqueItems": true, - "minItems": 1, - "items": { - "$ref": "#/definitions/flag" + } + }, + "repeatable": { + "title": "repeatable", + "description": "Whether the current positional argument can be repeated\nhttps://bashly.dannyb.co/configuration/argument/#repeatable", + "type": "boolean", + "default": false + }, + "validate": { + "title": "validate", + "description": "A validation function of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#validate", + "type": "string", + "examples": [ + "file_exists", + "dir_exists", + "integer", + "non_empty" + ] + }, + "unique": { + "title": "unique", + "description": "Whether the current positional argument is unique\nhttps://bashly.dannyb.co/configuration/argument/#unique", + "type": "boolean", + "default": false + } + }, + "dependencies": { + "unique": { + "properties": { + "repeatable": { + "const": true } + } + } + }, + "patternProperties": { + "^x_.": { + "title": "custom property", + "description": "A custom property of any type", + "examples": [ + "Anything" + ] + } + }, + "additionalProperties": false + }, + "flag": { + "title": "flag", + "description": "A flag of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/flag/", + "type": "object", + "anyOf": [ + { + "required": [ + "long" + ] + }, + { + "required": [ + "short" + ] + } + ], + "properties": { + "long": { + "title": "long", + "description": "A long form of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#long", + "type": "string", + "pattern": "^--", + "examples": [ + "--ssh" + ] + }, + "short": { + "title": "short", + "description": "A short form of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#short", + "type": "string", + "pattern": "^-[^-]", + "examples": [ + "-s" + ] }, - "commands-property": { - "title": "commands", - "description": "Subcommands of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#commands", - "type": "array", - "uniqueItems": true, - "items": { - "$ref": "#/definitions/command-property" + "help": { + "title": "help", + "description": "A description of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#help", + "type": "string", + "minLength": 1, + "examples": [ + "Clone using SSH" + ] + }, + "arg": { + "title": "arg", + "description": "An argument name of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#arg", + "type": "string", + "minLength": 1, + "examples": [ + "user" + ] + }, + "default": { + "title": "default", + "description": "A default value of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#default", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } } - }, - "root-version-property": { - "$comment": "'root-' prefix is used as this property is marked with 'Root Command Only' badge", - "title": "version", - "description": "A version of the current script\nhttps://bashly.dannyb.co/configuration/command/#version", - "type": "string", - "minLength": 1, - "examples": [ - "0.1.0" - ] - }, - "sub-command-default-property": { - "title": "default", - "description": "Whether to use the current command as a fallback when CLI used incorrectly\nhttps://bashly.dannyb.co/configuration/command/#default", - "oneOf": [ - { - "type": "boolean", - "default": false - }, - { - "type": "string", - "enum": [ - "force" - ] - } - ] - }, - "environment-variables-name-property": { - "$comment": "'environment-variables-' prefix is used as this property is related to https://bashly.dannyb.co/configuration/environment-variable/#environment-variable", - "title": "name", - "description": "A name of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#name", + ], + "examples": [ + "*.jpg" + ] + }, + "required": { + "title": "required", + "description": "Whether the current flag is required\nhttps://bashly.dannyb.co/configuration/flag/#required", + "type": "boolean", + "default": true + }, + "allowed": { + "title": "allowed", + "description": "Valid values of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#allowed", + "type": "array", + "minLength": 1, + "uniqueItems": true, + "items": { + "description": "A valid value of the current positional argument", "type": "string", "minLength": 1, "examples": [ - "config_path" + "user" ] - }, - "environment-variables-help-property": { - "title": "help", - "description": "A description of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#help", + } + }, + "conflicts": { + "title": "conflicts", + "description": "Mutually exclusive flags of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#conflicts", + "type": "array", + "minLength": 1, + "uniqueItems": true, + "items": { + "description": "A mutually exclusive flag of the current flag", "type": "string", "minLength": 1, "examples": [ - "Location of the config file" + "--no-cache" ] + } }, - "environment-variables-default-property": { - "title": "default", - "description": "A default value of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#default", + "completions": { + "title": "completions", + "description": "Completions of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#completions", + "type": "array", + "minLength": 1, + "uniqueItems": true, + "items": { + "description": "A completion of the current flag", "type": "string", - "examples": [ - "~/config.ini" - ] - }, - "environment-variables-private-property": { - "title": "private", - "description": "Whether the current environment variable is hidden from help\nhttps://bashly.dannyb.co/configuration/environment-variable/#private", - "type": "boolean", - "default": false - }, - "environment-variables-required-property": { - "title": "required", - "description": "Whether the current environment variable is required\nhttps://bashly.dannyb.co/configuration/environment-variable/#required", - "type": "boolean", - "default": true - }, - "environment-variables-property": { - "title": "environment variables", - "description": "Environment variables of the current application\nhttps://bashly.dannyb.co/configuration/environment-variable/#environment-variable", - "type": "array", - "uniqueItems": true, - "items": { - "title": "environment variable", - "description": "An environment variable of the current application\nhttps://bashly.dannyb.co/configuration/environment-variable/#environment-variable", - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "$ref": "#/definitions/environment-variables-name-property" - }, - "help": { - "$ref": "#/definitions/environment-variables-help-property" - }, - "default": { - "$ref": "#/definitions/environment-variables-default-property" - }, - "private": { - "$ref": "#/definitions/environment-variables-private-property" - }, - "required": { - "$ref": "#/definitions/environment-variables-required-property" - } - }, - "if": { - "properties": { - "required": { - "const": false - } - } - }, - "then": { - "properties": { - "name": { - "$ref": "#/definitions/environment-variables-name-property" - }, - "help": { - "$ref": "#/definitions/environment-variables-help-property" - }, - "default": { - "$ref": "#/definitions/environment-variables-default-property" - }, - "private": { - "$ref": "#/definitions/environment-variables-private-property" - }, - "required": { - "$ref": "#/definitions/environment-variables-required-property" - } - }, - "$ref": "#/definitions/custom-properties", - "additionalProperties": false - }, - "else": { - "properties": { - "name": { - "$ref": "#/definitions/environment-variables-name-property" - }, - "help": { - "$ref": "#/definitions/environment-variables-help-property" - }, - "private": { - "$ref": "#/definitions/environment-variables-private-property" - }, - "required": { - "$ref": "#/definitions/environment-variables-required-property" - } - }, - "$ref": "#/definitions/custom-properties", - "additionalProperties": false - } + "minLength": 1 + } + }, + "private": { + "title": "private", + "description": "Whether the current flag is hidden from help\nhttps://bashly.dannyb.co/configuration/flag/#private", + "type": "boolean", + "default": false + }, + "repeatable": { + "title": "repeatable", + "description": "Whether the current flag can be repeated\nhttps://bashly.dannyb.co/configuration/flag/#repeatable", + "type": "boolean", + "default": false + }, + "validate": { + "title": "validate", + "description": "A validation function of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#validate", + "type": "string", + "examples": [ + "file_exists", + "dir_exists", + "integer", + "non_empty" + ] + }, + "unique": { + "title": "unique", + "description": "Whether the current flag is unique\nhttps://bashly.dannyb.co/configuration/flag/#unique", + "type": "boolean", + "default": false + } + }, + "dependencies": { + "unique": { + "properties": { + "repeatable": { + "const": true } - }, - "examples-property": { - "title": "examples", - "oneOf": [ - { - "description": "An example of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#examples", - "type": "string", - "minLength": 1, - "examples": [ - "cli upload profile.png -u admin -p s3cr3t" - ] - }, - { - "description": "Examples of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#examples", - "type": "array", - "minItems": 1, - "uniqueItems": true, - "items": { - "description": "An example of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#examples", - "type": "string", - "minLength": 1, - "examples": [ - "cli upload profile.png -u admin -p s3cr3t" - ] - } - } - ] - }, - "footer-property": { - "title": "footer", - "description": "A description footer for the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#footer", - "type": "string", - "minLength": 1, - "examples": [ - "This will appear at the end of the --help message" - ] - }, - "sub-command-group-property": { - "title": "group", - "description": "A group of the current sub-command\nhttps://bashly.dannyb.co/configuration/command/#group", + } + } + }, + "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", + "type": "string", + "minLength": 1, + "examples": [ + "source" + ] + }, + "sub-command-alias-property": { + "$comment": "'sub-command-' prefix is used as this property is marked with 'Sub-Commands Only' badge", + "title": "alias", + "oneOf": [ + { + "description": "An alias of the current sub-command\nhttps://bashly.dannyb.co/configuration/command/#alias", + "type": "string", + "minLength": 1, + "examples": [ + "s" + ] + }, + { + "description": "Aliases of the current sub-command\nhttps://bashly.dannyb.co/configuration/command/#alias", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "description": "An alias of the current sub-command", "type": "string", "minLength": 1, "examples": [ - "File" + "s" ] - }, - "catch-all-property": { - "title": "catch all", - "description": "Whether to allow additional arguments or flags for the current command\nhttps://bashly.dannyb.co/configuration/command/#catch_all", - "oneOf": [ - { - "type": "boolean", - "default": false - }, - { - "type": "string", - "minLength": 1, - "examples": [ - "Additional arguments or flags for AWS CLI" - ] - }, - { - "type": "object", - "properties": { - "label": { - "description": "A label for the current argument or flag\nhttps://bashly.dannyb.co/configuration/command/#catch_all", - "type": "string", - "minLength": 1, - "examples": [ - "AWS Params" - ] - }, - "help": { - "description": "A description for the current argument or flag\nhttps://bashly.dannyb.co/configuration/command/#catch_all", - "type": "string", - "minLength": 1, - "examples": [ - "Additional arguments or flags for AWS CLI" - ] - }, - "required": { - "description": "Whether the current argument or flag is required\nhttps://bashly.dannyb.co/configuration/command/#catch_all", - "type": "boolean", - "default": false - } - }, - "additionalProperties": false - } - ] - }, - "completions-property": { - "title": "completions", - "description": "Completions of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#completions", - "type": "array", - "minLength": 1, - "uniqueItems": true, - "items": { - "description": "A completion of the current script or sub-command", - "type": "string", - "minLength": 1, - "examples": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] + } + } + ] + }, + "help-property": { + "title": "help", + "description": "A description of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#help", + "type": "string", + "minLength": 1, + "examples": [ + "URL to download from" + ] + }, + "args-property": { + "title": "args", + "description": "Arguments of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#args", + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "$ref": "#/definitions/argument" + } + }, + "flags-property": { + "title": "flags", + "description": "Flags of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#flags", + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "$ref": "#/definitions/flag" + } + }, + "commands-property": { + "title": "commands", + "description": "Subcommands of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#commands", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/command-property" + } + }, + "root-version-property": { + "$comment": "'root-' prefix is used as this property is marked with 'Root Command Only' badge", + "title": "version", + "description": "A version of the current script\nhttps://bashly.dannyb.co/configuration/command/#version", + "type": "string", + "minLength": 1, + "examples": [ + "0.1.0" + ] + }, + "sub-command-default-property": { + "title": "default", + "description": "Whether to use the current command as a fallback when CLI used incorrectly\nhttps://bashly.dannyb.co/configuration/command/#default", + "oneOf": [ + { + "type": "boolean", + "default": false + }, + { + "type": "string", + "enum": [ + "force" + ] + } + ] + }, + "environment-variables-name-property": { + "$comment": "'environment-variables-' prefix is used as this property is related to https://bashly.dannyb.co/configuration/environment-variable/#environment-variable", + "title": "name", + "description": "A name of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#name", + "type": "string", + "minLength": 1, + "examples": [ + "config_path" + ] + }, + "environment-variables-help-property": { + "title": "help", + "description": "A description of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#help", + "type": "string", + "minLength": 1, + "examples": [ + "Location of the config file" + ] + }, + "environment-variables-default-property": { + "title": "default", + "description": "A default value of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#default", + "type": "string", + "examples": [ + "~/config.ini" + ] + }, + "environment-variables-private-property": { + "title": "private", + "description": "Whether the current environment variable is hidden from help\nhttps://bashly.dannyb.co/configuration/environment-variable/#private", + "type": "boolean", + "default": false + }, + "environment-variables-required-property": { + "title": "required", + "description": "Whether the current environment variable is required\nhttps://bashly.dannyb.co/configuration/environment-variable/#required", + "type": "boolean", + "default": true + }, + "environment-variables-property": { + "title": "environment variables", + "description": "Environment variables of the current application\nhttps://bashly.dannyb.co/configuration/environment-variable/#environment-variable", + "type": "array", + "uniqueItems": true, + "items": { + "title": "environment variable", + "description": "An environment variable of the current application\nhttps://bashly.dannyb.co/configuration/environment-variable/#environment-variable", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "$ref": "#/definitions/environment-variables-name-property" + }, + "help": { + "$ref": "#/definitions/environment-variables-help-property" + }, + "default": { + "$ref": "#/definitions/environment-variables-default-property" + }, + "private": { + "$ref": "#/definitions/environment-variables-private-property" + }, + "required": { + "$ref": "#/definitions/environment-variables-required-property" + } + }, + "if": { + "properties": { + "required": { + "const": false } + } }, - "dependencies-command-property": { - "title": "command", - "description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#command", - "type": "array", - "minItems": 1, - "uniqueItems": true, - "items": { - "description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#command", - "type": "string", - "minLength": 1, - "examples": [ - "git" - ] + "then": { + "properties": { + "name": { + "$ref": "#/definitions/environment-variables-name-property" + }, + "help": { + "$ref": "#/definitions/environment-variables-help-property" + }, + "default": { + "$ref": "#/definitions/environment-variables-default-property" + }, + "private": { + "$ref": "#/definitions/environment-variables-private-property" + }, + "required": { + "$ref": "#/definitions/environment-variables-required-property" } + }, + "patternProperties": { + "^x_.": { + "title": "custom property", + "description": "A custom property of any type", + "examples": [ + "Anything" + ] + } + }, + "additionalProperties": false }, - "dependencies-help-property": { - "title": "help", - "description": "A help for the current dependency\nhttps://bashly.dannyb.co/configuration/dependency/#help", + "else": { + "properties": { + "name": { + "$ref": "#/definitions/environment-variables-name-property" + }, + "help": { + "$ref": "#/definitions/environment-variables-help-property" + }, + "private": { + "$ref": "#/definitions/environment-variables-private-property" + }, + "required": { + "$ref": "#/definitions/environment-variables-required-property" + } + }, + "patternProperties": { + "^x_.": { + "title": "custom property", + "description": "A custom property of any type", + "examples": [ + "Anything" + ] + } + }, + "additionalProperties": false + } + } + }, + "examples-property": { + "title": "examples", + "oneOf": [ + { + "description": "An example of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#examples", + "type": "string", + "minLength": 1, + "examples": [ + "cli upload profile.png -u admin -p s3cr3t" + ] + }, + { + "description": "Examples of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#examples", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "description": "An example of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#examples", "type": "string", "minLength": 1, "examples": [ - "Run 'sudo apt install git'" + "cli upload profile.png -u admin -p s3cr3t" ] - }, - "dependencies-property": { - "title": "dependencies", + } + } + ] + }, + "footer-property": { + "title": "footer", + "description": "A description footer for the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#footer", + "type": "string", + "minLength": 1, + "examples": [ + "This will appear at the end of the --help message" + ] + }, + "sub-command-group-property": { + "title": "group", + "description": "A group of the current sub-command\nhttps://bashly.dannyb.co/configuration/command/#group", + "type": "string", + "minLength": 1, + "examples": [ + "File" + ] + }, + "catch-all-property": { + "title": "catch all", + "description": "Whether to allow additional arguments or flags for the current command\nhttps://bashly.dannyb.co/configuration/command/#catch_all", + "oneOf": [ + { + "type": "boolean", + "default": false + }, + { + "type": "string", + "minLength": 1, + "examples": [ + "Additional arguments or flags for AWS CLI" + ] + }, + { + "type": "object", + "properties": { + "label": { + "description": "A label for the current argument or flag\nhttps://bashly.dannyb.co/configuration/command/#catch_all", + "type": "string", + "minLength": 1, + "examples": [ + "AWS Params" + ] + }, + "help": { + "description": "A description for the current argument or flag\nhttps://bashly.dannyb.co/configuration/command/#catch_all", + "type": "string", + "minLength": 1, + "examples": [ + "Additional arguments or flags for AWS CLI" + ] + }, + "required": { + "description": "Whether the current argument or flag is required\nhttps://bashly.dannyb.co/configuration/command/#catch_all", + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + ] + }, + "completions-property": { + "title": "completions", + "description": "Completions of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#completions", + "type": "array", + "minLength": 1, + "uniqueItems": true, + "items": { + "description": "A completion of the current script or sub-command", + "type": "string", + "minLength": 1, + "examples": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + } + }, + "dependencies-command-property": { + "title": "command", + "description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#command", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#command", + "type": "string", + "minLength": 1, + "examples": [ + "git" + ] + } + }, + "dependencies-help-property": { + "title": "help", + "description": "A help for the current dependency\nhttps://bashly.dannyb.co/configuration/dependency/#help", + "type": "string", + "minLength": 1, + "examples": [ + "Run 'sudo apt install git'" + ] + }, + "dependencies-property": { + "title": "dependencies", + "oneOf": [ + { + "description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", + "type": "array", + "minLength": 1, + "uniqueItems": true, + "items": { + "description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", "oneOf": [ - { - "description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", - "type": "array", - "minLength": 1, - "uniqueItems": true, - "items": { - "description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", - "oneOf": [ - { - "type": "string", - "minLength": 1 - }, - { - "type": "null" - } - ] - } - }, - { - "description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", - "type": "object", - "patternProperties": { - ".": { - "description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", - "oneOf": [ - { - "type": "string", - "minLength": 1 - }, - { - "type": "null" - }, - { - "type": "object", - "required": [ - "command" - ], - "properties": { - "command": { - "$ref": "#/definitions/dependencies-command-property" - }, - "help": { - "$ref": "#/definitions/dependencies-help-property" - } - }, - "additionalProperties": false - } - ] - } - }, - "additionalProperties": false - } + { + "type": "string", + "minLength": 1 + }, + { + "type": "null" + } ] - }, - "sub-command-expose-property": { - "title": "expose", - "description": "Whether to expose the current sub-command if it has sub-commands\nhttps://bashly.dannyb.co/configuration/command/#expose", - "oneOf": [ + } + }, + { + "description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", + "type": "object", + "patternProperties": { + ".": { + "description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency", + "oneOf": [ { - "type": "boolean", - "default": false + "type": "string", + "minLength": 1 }, { - "type": "string", - "enum": [ - "always" - ] - } - ] - }, - "root-extensible-property": { - "title": "extensible", - "description": "Whether to delegate the current unknown command to an external executable\nhttps://bashly.dannyb.co/configuration/command/#extensible", - "oneOf": [ - { - "type": "boolean", - "default": false + "type": "null" }, { - "type": "string", - "examples": [ - "git" - ] + "type": "object", + "required": [ + "command" + ], + "properties": { + "command": { + "$ref": "#/definitions/dependencies-command-property" + }, + "help": { + "$ref": "#/definitions/dependencies-help-property" + } + }, + "additionalProperties": false } - ] - }, - "filename-property": { - "title": "filename", - "description": "A partial file path of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#filename", - "type": "string", - "minLength": 1, - "examples": [ - "dir_commands/list.sh" - ] - }, - "filters-property": { - "title": "filters", - "description": "Filters of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#filters", - "type": "array", - "minItems": 1, - "items": { - "description": "A filter of the current script or sub-command", - "type": "string", - "minLength": 1, - "examples": [ - "docker_running" - ] + ] } - }, - "function-property": { - "title": "function", - "description": "An internal function for the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#function", - "type": "string", - "minLength": 1, - "examples": [ - "deprecated_container_start" - ] - }, - "sub-command-private-property": { - "title": "private", - "description": "Whether hide the current sub-command from help\nhttps://bashly.dannyb.co/configuration/command/#private", - "type": "boolean", - "default": false - }, - "sub-command-import-property": { - "title": "import", - "description": "A file import for the current sub-command\nhttps://bashly.dannyb.co/configuration/command/#import", - "type": "string", - "minLength": 1, - "examples": [ - "src/download_command.sh" - ] - }, - "command-property": { - "title": "command", - "description": "A command of the current application\nhttps://bashly.dannyb.co/configuration/command/#command", - "type": "object", - "properties": { - "name": { - "$ref": "#/definitions/name-property" - }, - "alias": { - "$ref": "#/definitions/sub-command-alias-property" - }, - "help": { - "$ref": "#/definitions/help-property" - }, - "args": { - "$ref": "#/definitions/args-property" - }, - "flags": { - "$ref": "#/definitions/flags-property" - }, - "commands": { - "$ref": "#/definitions/commands-property" - }, - "default": { - "$ref": "#/definitions/sub-command-default-property" - }, - "environment_variables": { - "$ref": "#/definitions/environment-variables-property" - }, - "examples": { - "$ref": "#/definitions/examples-property" - }, - "footer": { - "$ref": "#/definitions/footer-property" - }, - "group": { - "$ref": "#/definitions/sub-command-group-property" - }, - "catch_all": { - "$ref": "#/definitions/catch-all-property" - }, - "completions": { - "$ref": "#/definitions/completions-property" - }, - "dependencies": { - "$ref": "#/definitions/dependencies-property" - }, - "expose": { - "$ref": "#/definitions/sub-command-expose-property" - }, - "filename": { - "$ref": "#/definitions/filename-property" - }, - "filters": { - "$ref": "#/definitions/filters-property" - }, - "function": { - "$ref": "#/definitions/function-property" - }, - "private": { - "$ref": "#/definitions/sub-command-private-property" - }, - "import": { - "$ref": "#/definitions/sub-command-import-property" - } - }, - "$ref": "#/definitions/custom-properties", - "additionalProperties": false + }, + "additionalProperties": false + } + ] + }, + "sub-command-expose-property": { + "title": "expose", + "description": "Whether to expose the current sub-command if it has sub-commands\nhttps://bashly.dannyb.co/configuration/command/#expose", + "oneOf": [ + { + "type": "boolean", + "default": false + }, + { + "type": "string", + "enum": [ + "always" + ] + } + ] + }, + "root-extensible-property": { + "title": "extensible", + "description": "Whether to delegate the current unknown command to an external executable\nhttps://bashly.dannyb.co/configuration/command/#extensible", + "oneOf": [ + { + "type": "boolean", + "default": false + }, + { + "type": "string", + "examples": [ + "git" + ] } + ] + }, + "filename-property": { + "title": "filename", + "description": "A partial file path of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#filename", + "type": "string", + "minLength": 1, + "examples": [ + "dir_commands/list.sh" + ] }, - "title": "cli", - "description": "A CLI of the current application\nhttps://bashly.dannyb.co/usage/getting-started/", - "type": "object", - "properties": { + "filters-property": { + "title": "filters", + "description": "Filters of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#filters", + "type": "array", + "minItems": 1, + "items": { + "description": "A filter of the current script or sub-command", + "type": "string", + "minLength": 1, + "examples": [ + "docker_running" + ] + } + }, + "function-property": { + "title": "function", + "description": "An internal function for the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#function", + "type": "string", + "minLength": 1, + "examples": [ + "deprecated_container_start" + ] + }, + "sub-command-private-property": { + "title": "private", + "description": "Whether hide the current sub-command from help\nhttps://bashly.dannyb.co/configuration/command/#private", + "type": "boolean", + "default": false + }, + "sub-command-import-property": { + "title": "import", + "description": "A file import for the current sub-command\nhttps://bashly.dannyb.co/configuration/command/#import", + "type": "string", + "minLength": 1, + "examples": [ + "src/download_command.sh" + ] + }, + "command-property": { + "title": "command", + "description": "A command of the current application\nhttps://bashly.dannyb.co/configuration/command/#command", + "type": "object", + "properties": { "name": { - "$ref": "#/definitions/name-property" + "$ref": "#/definitions/name-property" + }, + "alias": { + "$ref": "#/definitions/sub-command-alias-property" }, "help": { - "$ref": "#/definitions/help-property" + "$ref": "#/definitions/help-property" }, "args": { - "$ref": "#/definitions/args-property" + "$ref": "#/definitions/args-property" }, "flags": { - "$ref": "#/definitions/flags-property" + "$ref": "#/definitions/flags-property" }, "commands": { - "$ref": "#/definitions/commands-property" + "$ref": "#/definitions/commands-property" }, - "version": { - "$ref": "#/definitions/root-version-property" + "default": { + "$ref": "#/definitions/sub-command-default-property" }, "environment_variables": { - "$ref": "#/definitions/environment-variables-property" + "$ref": "#/definitions/environment-variables-property" }, "examples": { - "$ref": "#/definitions/examples-property" + "$ref": "#/definitions/examples-property" }, "footer": { - "$ref": "#/definitions/footer-property" + "$ref": "#/definitions/footer-property" + }, + "group": { + "$ref": "#/definitions/sub-command-group-property" }, "catch_all": { - "$ref": "#/definitions/catch-all-property" + "$ref": "#/definitions/catch-all-property" }, "completions": { - "$ref": "#/definitions/completions-property" + "$ref": "#/definitions/completions-property" }, "dependencies": { - "$ref": "#/definitions/dependencies-property" + "$ref": "#/definitions/dependencies-property" }, - "extensible": { - "$ref": "#/definitions/root-extensible-property" + "expose": { + "$ref": "#/definitions/sub-command-expose-property" }, "filename": { - "$ref": "#/definitions/filename-property" + "$ref": "#/definitions/filename-property" }, "filters": { - "$ref": "#/definitions/filters-property" + "$ref": "#/definitions/filters-property" }, "function": { - "$ref": "#/definitions/function-property" + "$ref": "#/definitions/function-property" + }, + "private": { + "$ref": "#/definitions/sub-command-private-property" + }, + "import": { + "$ref": "#/definitions/sub-command-import-property" } + }, + "patternProperties": { + "^x_.": { + "title": "custom property", + "description": "A custom property of any type", + "examples": [ + "Anything" + ] + } + }, + "additionalProperties": false + } + }, + "title": "cli", + "description": "A CLI of the current application\nhttps://bashly.dannyb.co/usage/getting-started/", + "type": "object", + "properties": { + "name": { + "$ref": "#/definitions/name-property" + }, + "help": { + "$ref": "#/definitions/help-property" + }, + "args": { + "$ref": "#/definitions/args-property" + }, + "flags": { + "$ref": "#/definitions/flags-property" + }, + "commands": { + "$ref": "#/definitions/commands-property" + }, + "version": { + "$ref": "#/definitions/root-version-property" + }, + "environment_variables": { + "$ref": "#/definitions/environment-variables-property" + }, + "examples": { + "$ref": "#/definitions/examples-property" + }, + "footer": { + "$ref": "#/definitions/footer-property" + }, + "catch_all": { + "$ref": "#/definitions/catch-all-property" + }, + "completions": { + "$ref": "#/definitions/completions-property" + }, + "dependencies": { + "$ref": "#/definitions/dependencies-property" + }, + "extensible": { + "$ref": "#/definitions/root-extensible-property" + }, + "filename": { + "$ref": "#/definitions/filename-property" + }, + "filters": { + "$ref": "#/definitions/filters-property" }, - "$ref": "#/definitions/custom-properties", - "additionalProperties": false -} \ No newline at end of file + "function": { + "$ref": "#/definitions/function-property" + } + }, + "patternProperties": { + "^x_.": { + "title": "custom property", + "description": "A custom property of any type", + "examples": [ + "Anything" + ] + } + }, + "additionalProperties": false +} diff --git a/schemas/src/bashly.yml b/schemas/src/bashly.yml new file mode 100644 index 00000000..3bd64e03 --- /dev/null +++ b/schemas/src/bashly.yml @@ -0,0 +1,774 @@ +$schema: http://json-schema.org/draft-07/schema +definitions: + argument: + title: argument + description: |- + A positional argument of the current script or sub-command + https://bashly.dannyb.co/configuration/argument/ + type: object + required: + - name + properties: + name: + title: name + description: |- + A name of the current positional argument + https://bashly.dannyb.co/configuration/argument/#name + type: string + minLength: 1 + examples: + - user + help: + title: help + description: |- + A description of the current positional argument + https://bashly.dannyb.co/configuration/argument/#help + type: string + minLength: 1 + examples: + - AWS Username + default: + title: default + description: |- + A default value of the current positional argument + https://bashly.dannyb.co/configuration/argument/#default + oneOf: + - type: string + - type: array + minItems: 1 + items: + type: string + examples: + - '*.jpg' + required: + title: required + description: |- + Whether the current positional argument is required + https://bashly.dannyb.co/configuration/argument/#required + type: boolean + default: true + allowed: + title: allowed + description: |- + Valid values of the current positional argument + https://bashly.dannyb.co/configuration/argument/#allowed + type: array + minLength: 1 + uniqueItems: true + items: + description: A valid value of the current positional argument + type: string + minLength: 1 + examples: + - eu + repeatable: + title: repeatable + description: |- + Whether the current positional argument can be repeated + https://bashly.dannyb.co/configuration/argument/#repeatable + type: boolean + default: false + validate: + title: validate + description: |- + A validation function of the current positional argument + https://bashly.dannyb.co/configuration/argument/#validate + type: string + examples: + - file_exists + - dir_exists + - integer + - non_empty + unique: + title: unique + description: |- + Whether the current positional argument is unique + https://bashly.dannyb.co/configuration/argument/#unique + type: boolean + default: false + dependencies: + unique: + properties: + repeatable: + const: true + patternProperties: &custom-properties + ^x_.: + title: custom property + description: A custom property of any type + examples: + - Anything + additionalProperties: false + flag: + title: flag + description: |- + A flag of the current script or sub-command + https://bashly.dannyb.co/configuration/flag/ + type: object + anyOf: + - required: + - long + - required: + - short + properties: + long: + title: long + description: |- + A long form of the current flag + https://bashly.dannyb.co/configuration/flag/#long + type: string + pattern: ^-- + examples: + - --ssh + short: + title: short + description: |- + A short form of the current flag + https://bashly.dannyb.co/configuration/flag/#short + type: string + pattern: ^-[^-] + examples: + - -s + help: + title: help + description: |- + A description of the current flag + https://bashly.dannyb.co/configuration/flag/#help + type: string + minLength: 1 + examples: + - Clone using SSH + arg: + title: arg + description: |- + An argument name of the current flag + https://bashly.dannyb.co/configuration/flag/#arg + type: string + minLength: 1 + examples: + - user + default: + title: default + description: |- + A default value of the current flag + https://bashly.dannyb.co/configuration/flag/#default + oneOf: + - type: string + - type: array + minItems: 1 + items: + type: string + examples: + - '*.jpg' + required: + title: required + description: |- + Whether the current flag is required + https://bashly.dannyb.co/configuration/flag/#required + type: boolean + default: true + allowed: + title: allowed + description: |- + Valid values of the current flag + https://bashly.dannyb.co/configuration/flag/#allowed + type: array + minLength: 1 + uniqueItems: true + items: + description: A valid value of the current positional argument + type: string + minLength: 1 + examples: + - user + conflicts: + title: conflicts + description: |- + Mutually exclusive flags of the current flag + https://bashly.dannyb.co/configuration/flag/#conflicts + type: array + minLength: 1 + uniqueItems: true + items: + description: A mutually exclusive flag of the current flag + type: string + minLength: 1 + examples: + - --no-cache + completions: + title: completions + description: |- + Completions of the current flag + https://bashly.dannyb.co/configuration/flag/#completions + type: array + minLength: 1 + uniqueItems: true + items: + description: A completion of the current flag + type: string + minLength: 1 + private: + title: private + description: |- + Whether the current flag is hidden from help + https://bashly.dannyb.co/configuration/flag/#private + type: boolean + default: false + repeatable: + title: repeatable + description: |- + Whether the current flag can be repeated + https://bashly.dannyb.co/configuration/flag/#repeatable + type: boolean + default: false + validate: + title: validate + description: |- + A validation function of the current flag + https://bashly.dannyb.co/configuration/flag/#validate + type: string + examples: + - file_exists + - dir_exists + - integer + - non_empty + unique: + title: unique + description: |- + Whether the current flag is unique + https://bashly.dannyb.co/configuration/flag/#unique + type: boolean + default: false + dependencies: + unique: + properties: + repeatable: + const: true + patternProperties: *custom-properties + additionalProperties: false + name-property: + title: name + description: |- + A name of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#name + type: string + minLength: 1 + examples: + - source + sub-command-alias-property: + $comment: '''sub-command-'' prefix is used as this property is marked with ''Sub-Commands Only'' badge' + title: alias + oneOf: + - description: |- + An alias of the current sub-command + https://bashly.dannyb.co/configuration/command/#alias + type: string + minLength: 1 + examples: + - s + - description: |- + Aliases of the current sub-command + https://bashly.dannyb.co/configuration/command/#alias + type: array + minItems: 1 + uniqueItems: true + items: + description: An alias of the current sub-command + type: string + minLength: 1 + examples: + - s + help-property: + title: help + description: |- + A description of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#help + type: string + minLength: 1 + examples: + - URL to download from + args-property: + title: args + description: |- + Arguments of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#args + type: array + uniqueItems: true + minItems: 1 + items: + $ref: '#/definitions/argument' + flags-property: + title: flags + description: |- + Flags of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#flags + type: array + uniqueItems: true + minItems: 1 + items: + $ref: '#/definitions/flag' + commands-property: + title: commands + description: |- + Subcommands of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#commands + type: array + uniqueItems: true + items: + $ref: '#/definitions/command-property' + root-version-property: + $comment: '''root-'' prefix is used as this property is marked with ''Root Command Only'' badge' + title: version + description: |- + A version of the current script + https://bashly.dannyb.co/configuration/command/#version + type: string + minLength: 1 + examples: + - 0.1.0 + sub-command-default-property: + title: default + description: |- + Whether to use the current command as a fallback when CLI used incorrectly + https://bashly.dannyb.co/configuration/command/#default + oneOf: + - type: boolean + default: false + - type: string + enum: + - force + environment-variables-name-property: + $comment: '''environment-variables-'' prefix is used as this property is related to https://bashly.dannyb.co/configuration/environment-variable/#environment-variable' + title: name + description: |- + A name of the current environment variable + https://bashly.dannyb.co/configuration/environment-variable/#name + type: string + minLength: 1 + examples: + - config_path + environment-variables-help-property: + title: help + description: |- + A description of the current environment variable + https://bashly.dannyb.co/configuration/environment-variable/#help + type: string + minLength: 1 + examples: + - Location of the config file + environment-variables-default-property: + title: default + description: |- + A default value of the current environment variable + https://bashly.dannyb.co/configuration/environment-variable/#default + type: string + examples: + - ~/config.ini + environment-variables-private-property: + title: private + description: |- + Whether the current environment variable is hidden from help + https://bashly.dannyb.co/configuration/environment-variable/#private + type: boolean + default: false + environment-variables-required-property: + title: required + description: |- + Whether the current environment variable is required + https://bashly.dannyb.co/configuration/environment-variable/#required + type: boolean + default: true + environment-variables-property: + title: environment variables + description: |- + Environment variables of the current application + https://bashly.dannyb.co/configuration/environment-variable/#environment-variable + type: array + uniqueItems: true + items: + title: environment variable + description: |- + An environment variable of the current application + https://bashly.dannyb.co/configuration/environment-variable/#environment-variable + type: object + required: + - name + properties: + name: + $ref: '#/definitions/environment-variables-name-property' + help: + $ref: '#/definitions/environment-variables-help-property' + default: + $ref: '#/definitions/environment-variables-default-property' + private: + $ref: '#/definitions/environment-variables-private-property' + required: + $ref: '#/definitions/environment-variables-required-property' + if: + properties: + required: + const: false + then: + properties: + name: + $ref: '#/definitions/environment-variables-name-property' + help: + $ref: '#/definitions/environment-variables-help-property' + default: + $ref: '#/definitions/environment-variables-default-property' + private: + $ref: '#/definitions/environment-variables-private-property' + required: + $ref: '#/definitions/environment-variables-required-property' + patternProperties: *custom-properties + additionalProperties: false + else: + properties: + name: + $ref: '#/definitions/environment-variables-name-property' + help: + $ref: '#/definitions/environment-variables-help-property' + private: + $ref: '#/definitions/environment-variables-private-property' + required: + $ref: '#/definitions/environment-variables-required-property' + patternProperties: *custom-properties + additionalProperties: false + examples-property: + title: examples + oneOf: + - description: |- + An example of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#examples + type: string + minLength: 1 + examples: + - cli upload profile.png -u admin -p s3cr3t + - description: |- + Examples of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#examples + type: array + minItems: 1 + uniqueItems: true + items: + description: |- + An example of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#examples + type: string + minLength: 1 + examples: + - cli upload profile.png -u admin -p s3cr3t + footer-property: + title: footer + description: |- + A description footer for the current script or sub-command + https://bashly.dannyb.co/configuration/command/#footer + type: string + minLength: 1 + examples: + - This will appear at the end of the --help message + sub-command-group-property: + title: group + description: |- + A group of the current sub-command + https://bashly.dannyb.co/configuration/command/#group + type: string + minLength: 1 + examples: + - File + catch-all-property: + title: catch all + description: |- + Whether to allow additional arguments or flags for the current command + https://bashly.dannyb.co/configuration/command/#catch_all + oneOf: + - type: boolean + default: false + - type: string + minLength: 1 + examples: + - Additional arguments or flags for AWS CLI + - type: object + properties: + label: + description: |- + A label for the current argument or flag + https://bashly.dannyb.co/configuration/command/#catch_all + type: string + minLength: 1 + examples: + - AWS Params + help: + description: |- + A description for the current argument or flag + https://bashly.dannyb.co/configuration/command/#catch_all + type: string + minLength: 1 + examples: + - Additional arguments or flags for AWS CLI + required: + description: |- + Whether the current argument or flag is required + https://bashly.dannyb.co/configuration/command/#catch_all + type: boolean + default: false + additionalProperties: false + completions-property: + title: completions + description: |- + Completions of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#completions + type: array + minLength: 1 + uniqueItems: true + items: + description: A completion of the current script or sub-command + type: string + minLength: 1 + examples: + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + dependencies-command-property: + title: command + description: |- + Dependencies of the current script or sub-command + https://bashly.dannyb.co/configuration/dependency/#command + type: array + minItems: 1 + uniqueItems: true + items: + description: |- + A dependency of the current script or sub-command + https://bashly.dannyb.co/configuration/dependency/#command + type: string + minLength: 1 + examples: + - git + dependencies-help-property: + title: help + description: |- + A help for the current dependency + https://bashly.dannyb.co/configuration/dependency/#help + type: string + minLength: 1 + examples: + - Run 'sudo apt install git' + dependencies-property: + title: dependencies + oneOf: + - description: |- + Dependencies of the current script or sub-command + https://bashly.dannyb.co/configuration/dependency/#dependency + type: array + minLength: 1 + uniqueItems: true + items: + description: |- + A dependency of the current script or sub-command + https://bashly.dannyb.co/configuration/dependency/#dependency + oneOf: + - type: string + minLength: 1 + - type: "null" + - description: |- + Dependencies of the current script or sub-command + https://bashly.dannyb.co/configuration/dependency/#dependency + type: object + patternProperties: + .: + description: |- + A dependency of the current script or sub-command + https://bashly.dannyb.co/configuration/dependency/#dependency + oneOf: + - type: string + minLength: 1 + - type: "null" + - type: object + required: + - command + properties: + command: + $ref: '#/definitions/dependencies-command-property' + help: + $ref: '#/definitions/dependencies-help-property' + additionalProperties: false + additionalProperties: false + sub-command-expose-property: + title: expose + description: |- + Whether to expose the current sub-command if it has sub-commands + https://bashly.dannyb.co/configuration/command/#expose + oneOf: + - type: boolean + default: false + - type: string + enum: + - always + root-extensible-property: + title: extensible + description: |- + Whether to delegate the current unknown command to an external executable + https://bashly.dannyb.co/configuration/command/#extensible + oneOf: + - type: boolean + default: false + - type: string + examples: + - git + filename-property: + title: filename + description: |- + A partial file path of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#filename + type: string + minLength: 1 + examples: + - dir_commands/list.sh + filters-property: + title: filters + description: |- + Filters of the current script or sub-command + https://bashly.dannyb.co/configuration/command/#filters + type: array + minItems: 1 + items: + description: A filter of the current script or sub-command + type: string + minLength: 1 + examples: + - docker_running + function-property: + title: function + description: |- + An internal function for the current script or sub-command + https://bashly.dannyb.co/configuration/command/#function + type: string + minLength: 1 + examples: + - deprecated_container_start + sub-command-private-property: + title: private + description: |- + Whether hide the current sub-command from help + https://bashly.dannyb.co/configuration/command/#private + type: boolean + default: false + sub-command-import-property: + title: import + description: |- + A file import for the current sub-command + https://bashly.dannyb.co/configuration/command/#import + type: string + minLength: 1 + examples: + - src/download_command.sh + command-property: + title: command + description: |- + A command of the current application + https://bashly.dannyb.co/configuration/command/#command + type: object + properties: + name: + $ref: '#/definitions/name-property' + alias: + $ref: '#/definitions/sub-command-alias-property' + help: + $ref: '#/definitions/help-property' + args: + $ref: '#/definitions/args-property' + flags: + $ref: '#/definitions/flags-property' + commands: + $ref: '#/definitions/commands-property' + default: + $ref: '#/definitions/sub-command-default-property' + environment_variables: + $ref: '#/definitions/environment-variables-property' + examples: + $ref: '#/definitions/examples-property' + footer: + $ref: '#/definitions/footer-property' + group: + $ref: '#/definitions/sub-command-group-property' + catch_all: + $ref: '#/definitions/catch-all-property' + completions: + $ref: '#/definitions/completions-property' + dependencies: + $ref: '#/definitions/dependencies-property' + expose: + $ref: '#/definitions/sub-command-expose-property' + filename: + $ref: '#/definitions/filename-property' + filters: + $ref: '#/definitions/filters-property' + function: + $ref: '#/definitions/function-property' + private: + $ref: '#/definitions/sub-command-private-property' + import: + $ref: '#/definitions/sub-command-import-property' + patternProperties: *custom-properties + additionalProperties: false +title: cli +description: |- + A CLI of the current application + https://bashly.dannyb.co/usage/getting-started/ +type: object +properties: + name: + $ref: '#/definitions/name-property' + help: + $ref: '#/definitions/help-property' + args: + $ref: '#/definitions/args-property' + flags: + $ref: '#/definitions/flags-property' + commands: + $ref: '#/definitions/commands-property' + version: + $ref: '#/definitions/root-version-property' + environment_variables: + $ref: '#/definitions/environment-variables-property' + examples: + $ref: '#/definitions/examples-property' + footer: + $ref: '#/definitions/footer-property' + catch_all: + $ref: '#/definitions/catch-all-property' + completions: + $ref: '#/definitions/completions-property' + dependencies: + $ref: '#/definitions/dependencies-property' + extensible: + $ref: '#/definitions/root-extensible-property' + filename: + $ref: '#/definitions/filename-property' + filters: + $ref: '#/definitions/filters-property' + function: + $ref: '#/definitions/function-property' +patternProperties: *custom-properties +additionalProperties: false diff --git a/schemas/src/op.conf b/schemas/src/op.conf new file mode 100644 index 00000000..2be4ba17 --- /dev/null +++ b/schemas/src/op.conf @@ -0,0 +1,7 @@ +check: check-jsonschema --schemafile ../schema.json +#? Check a file against the bashly.json schema +#? usage: op check FILE + +generate: yq -p yaml -o json bashly.yml > ../bashly.json +#? Convert the YAML schema to JSON +#? usage: op generate