Skip to content

Command reference schema

The command reference schema describes what --help --format json prints for any command: the reference of the deepest command on the command line. It is built from the command model that the parser uses, so it lists exactly the options that the command accepts: its usage, parameters, options, subcommands and exit codes. Options that exist only for tests are left out. The command pages of this site are generated from the same reference. The reference of version, for example:

Terminal window
$ witnyx version --help --format json
{
"schema" : "https://witnyx.dev/schemas/help/v1.json",
"command" : "witnyx version",
"description" : "Print the version, the cache folder and the age of each cached data source.",
"usage" : "witnyx version [-hV] [--cache-dir=DIR] [--format=FORMAT]",
"parameters" : [ ],
"options" : [ {
"names" : [ "--cache-dir" ],
"label" : "DIR",
"description" : "Cache directory for public data (default: the platform's cache folder).",
"repeatable" : false,
"negatable" : false
}, {
"names" : [ "-h", "--help" ],
"description" : "Show this help message and exit.",
"repeatable" : false,
"negatable" : false
}, {
"names" : [ "-V", "--version" ],
"description" : "Print version information and exit.",
"repeatable" : false,
"negatable" : false
}, {
"names" : [ "--format" ],
"label" : "FORMAT",
"description" : "With --help: text (the default) or json, a machine-readable reference.",
"repeatable" : false,
"negatable" : false
} ],
"subcommands" : [ ],
"exitCodes" : [ {
"code" : 0,
"meaning" : "Done."
}, {
"code" : 2,
"meaning" : "Could not run: a usage error, an input error or a failed download."
} ]
}

Its ID is https://witnyx.dev/schemas/help/v1.json, and every reference names it in its schema field. witnyx schema help prints the copy bundled with the tool:

Terminal window
$ witnyx schema help
"$id": "https://witnyx.dev/schemas/help/v1.json",
"title": "Witnyx command reference, version 1",
help-v1.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://witnyx.dev/schemas/help/v1.json",
"title": "Witnyx command reference, version 1",
"description": "Printed by `witnyx [COMMAND] --help --format json` (spec sections 9 and 12.4) for the deepest command on the command line. It is built from the command model the parser uses, so it lists exactly the options the command accepts. Hidden test options are left out.",
"type": "object",
"additionalProperties": false,
"required": ["schema", "command", "description", "usage", "parameters", "options", "subcommands", "exitCodes"],
"properties": {
"schema": { "const": "https://witnyx.dev/schemas/help/v1.json" },
"command": {
"description": "The full command, for example \"witnyx cache update\".",
"type": "string",
"pattern": "^witnyx( [a-z]+)*$"
},
"description": { "type": "string" },
"usage": { "description": "The usage line of the text help, on one line.", "type": "string", "minLength": 1 },
"parameters": { "type": "array", "items": { "$ref": "#/$defs/parameter" } },
"options": { "type": "array", "items": { "$ref": "#/$defs/option" } },
"subcommands": { "type": "array", "items": { "$ref": "#/$defs/subcommand" } },
"exitCodes": { "type": "array", "minItems": 2, "items": { "$ref": "#/$defs/exitCode" } }
},
"$defs": {
"parameter": {
"description": "A positional parameter.",
"type": "object",
"additionalProperties": false,
"required": ["label", "description", "required"],
"properties": {
"label": { "type": "string", "minLength": 1 },
"description": { "type": "string" },
"required": { "type": "boolean" },
"defaultValue": { "type": "string" }
}
},
"option": {
"type": "object",
"additionalProperties": false,
"required": ["names", "description", "repeatable", "negatable"],
"properties": {
"names": { "type": "array", "minItems": 1, "items": { "type": "string", "pattern": "^--?[A-Za-z]" } },
"label": { "description": "The placeholder of the option's value; left out when the option takes no value.", "type": "string", "minLength": 1 },
"description": { "type": "string" },
"defaultValue": { "type": "string" },
"repeatable": { "description": "Whether the option may be given more than once.", "type": "boolean" },
"negatable": { "description": "Whether the --no- form is accepted too, for example --no-agent.", "type": "boolean" }
}
},
"subcommand": {
"type": "object",
"additionalProperties": false,
"required": ["name", "description"],
"properties": {
"name": { "type": "string", "pattern": "^[a-z]+$" },
"description": { "type": "string" }
}
},
"exitCode": {
"type": "object",
"additionalProperties": false,
"required": ["code", "meaning"],
"properties": {
"code": { "enum": [0, 1, 2] },
"meaning": { "type": "string", "minLength": 1 }
}
}
}
}

Witnyx is a record-keeping and workflow tool. It does not certify compliance. Nothing on this site is legal advice.