|
7 | 7 | * file that was distributed with this source code. |
8 | 8 | */ |
9 | 9 |
|
10 | | -export const schemaRoot = import.meta.url |
| 10 | +export const schema = { |
| 11 | + $ref: '#/definitions/CommandMetaData', |
| 12 | + $schema: 'http://json-schema.org/draft-07/schema#', |
| 13 | + definitions: { |
| 14 | + CommandMetaData: { |
| 15 | + description: 'Command metdata required to display command help.', |
| 16 | + properties: { |
| 17 | + aliases: { |
| 18 | + description: 'Command aliases. The same command can be run using these aliases as well.', |
| 19 | + items: { |
| 20 | + type: 'string', |
| 21 | + }, |
| 22 | + type: 'array', |
| 23 | + }, |
| 24 | + args: { |
| 25 | + description: 'Args accepted by the command', |
| 26 | + items: { |
| 27 | + additionalProperties: false, |
| 28 | + properties: { |
| 29 | + allowEmptyValue: { |
| 30 | + description: |
| 31 | + 'Whether or not to allow empty values. When set to false, the validation will fail if the argument is provided an empty string\n\nDefaults to false', |
| 32 | + type: 'boolean', |
| 33 | + }, |
| 34 | + argumentName: { |
| 35 | + type: 'string', |
| 36 | + }, |
| 37 | + default: {}, |
| 38 | + description: { |
| 39 | + type: 'string', |
| 40 | + }, |
| 41 | + name: { |
| 42 | + type: 'string', |
| 43 | + }, |
| 44 | + required: { |
| 45 | + type: 'boolean', |
| 46 | + }, |
| 47 | + type: { |
| 48 | + enum: ['string', 'spread'], |
| 49 | + type: 'string', |
| 50 | + }, |
| 51 | + }, |
| 52 | + required: ['name', 'argumentName', 'type'], |
| 53 | + type: 'object', |
| 54 | + }, |
| 55 | + type: 'array', |
| 56 | + }, |
| 57 | + commandName: { |
| 58 | + description: 'The name of the command', |
| 59 | + type: 'string', |
| 60 | + }, |
| 61 | + description: { |
| 62 | + description: 'The command description to show on the help screen', |
| 63 | + type: 'string', |
| 64 | + }, |
| 65 | + flags: { |
| 66 | + description: 'Flags accepted by the command', |
| 67 | + items: { |
| 68 | + additionalProperties: false, |
| 69 | + properties: { |
| 70 | + alias: { |
| 71 | + anyOf: [ |
| 72 | + { |
| 73 | + type: 'string', |
| 74 | + }, |
| 75 | + { |
| 76 | + items: { |
| 77 | + type: 'string', |
| 78 | + }, |
| 79 | + type: 'array', |
| 80 | + }, |
| 81 | + ], |
| 82 | + }, |
| 83 | + allowEmptyValue: { |
| 84 | + description: |
| 85 | + 'Whether or not to allow empty values. When set to false, the validation will fail if the flag is mentioned but no value is provided\n\nDefaults to false', |
| 86 | + type: 'boolean', |
| 87 | + }, |
| 88 | + default: {}, |
| 89 | + description: { |
| 90 | + type: 'string', |
| 91 | + }, |
| 92 | + flagName: { |
| 93 | + type: 'string', |
| 94 | + }, |
| 95 | + name: { |
| 96 | + type: 'string', |
| 97 | + }, |
| 98 | + required: { |
| 99 | + type: 'boolean', |
| 100 | + }, |
| 101 | + showNegatedVariantInHelp: { |
| 102 | + description: |
| 103 | + 'Whether or not to display the negated variant in the help output.\n\nApplicable for boolean flags only\n\nDefaults to false', |
| 104 | + type: 'boolean', |
| 105 | + }, |
| 106 | + type: { |
| 107 | + enum: ['string', 'boolean', 'number', 'array'], |
| 108 | + type: 'string', |
| 109 | + }, |
| 110 | + }, |
| 111 | + required: ['name', 'flagName', 'type'], |
| 112 | + type: 'object', |
| 113 | + }, |
| 114 | + type: 'array', |
| 115 | + }, |
| 116 | + help: { |
| 117 | + anyOf: [ |
| 118 | + { |
| 119 | + type: 'string', |
| 120 | + }, |
| 121 | + { |
| 122 | + items: { |
| 123 | + type: 'string', |
| 124 | + }, |
| 125 | + type: 'array', |
| 126 | + }, |
| 127 | + ], |
| 128 | + description: 'Help text for the command', |
| 129 | + }, |
| 130 | + namespace: { |
| 131 | + description: 'Command namespace. The namespace is extracted from the command name', |
| 132 | + type: ['string', 'null'], |
| 133 | + }, |
| 134 | + options: { |
| 135 | + $ref: '#/definitions/CommandOptions', |
| 136 | + description: 'Command configuration options', |
| 137 | + }, |
| 138 | + }, |
| 139 | + required: ['aliases', 'args', 'commandName', 'description', 'flags', 'namespace', 'options'], |
| 140 | + type: 'object', |
| 141 | + }, |
| 142 | + CommandOptions: { |
| 143 | + description: 'Static set of command options', |
| 144 | + properties: { |
| 145 | + allowUnknownFlags: { |
| 146 | + description: |
| 147 | + 'Whether or not to allow for unknown flags. If set to false, the command will not run when unknown flags are provided through the CLI\n\nDefaults to false', |
| 148 | + type: 'boolean', |
| 149 | + }, |
| 150 | + staysAlive: { |
| 151 | + description: |
| 152 | + 'When flag set to true, the kernel will not trigger the termination process unless the command explicitly calls the terminate method.\n\nDefaults to false', |
| 153 | + type: 'boolean', |
| 154 | + }, |
| 155 | + }, |
| 156 | + type: 'object', |
| 157 | + }, |
| 158 | + }, |
| 159 | +} |
0 commit comments