-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli.schema.yaml
133 lines (127 loc) · 4.67 KB
/
cli.schema.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
$schema: https://json-schema.org/draft/2020-12/schema
$id: https://github.com/Jumpaku/cyamli/raw/v1.1.7/schema/cli.schema.json
title: cyamli CLI schema
description: CLI schema for cyamli.
$ref: '#/$defs/program'
$defs:
program:
description: |
Program is a root command that may have a name and a version.
It consists of commands recursively.
allOf:
- type: object
properties:
name:
description: |
Name of the program.
The default value is an empty string.
type: string
version:
description: |
Version of the program.
The default value is an empty string.
type: string
- $ref: '#/$defs/command'
type:
description: |
Type represents a type of a value that can be assigned to an option or an argument.
One of "string", "integer", "boolean", or "float" is available.
type: string
enum: ["", string, integer, boolean, float]
command:
description: |
Command represents a root command or a subcommand of the program.
It may have options, arguments, and subcommands recursively.
type: object
properties:
description:
description: |
Description of the command.
The default value is an empty string.
type: string
options:
description: |
A collection of options, which is a mapping from option names to options.
The default value is an empty object.
A property name is a name of an option, which must match the regular expression `^(-[a-z][a-z0-9]*)+$` and be unique in options of the command.
type: object
additionalProperties:
$ref: '#/$defs/option'
propertyNames:
pattern: "^(-[a-z][a-z0-9]*)+$"
arguments:
description: |
A list of arguments.
The default value is an empty array.
type: array
items:
$ref: '#/$defs/argument'
subcommands:
description: |
A collection of subcommands, which is a mapping from subcommand names to child commands.
The default value is an empty object.
A property name is a name of a subcommand, which must match the regular expression `^[a-z][a-z0-9]*$` and be unique in subcommands of the command.
type: object
additionalProperties:
$ref: '#/$defs/command'
propertyNames:
pattern: "^[a-z][a-z0-9]*$"
option:
description: |
Option represents an optional argument in command line arguments.
type: object
properties:
short:
description: |
Short name of the option, which must match the regular expression `^-[a-z]$` and be unique in options of the command which the option belongs to.
If short is not specified then short name for this option is not available.
type: string
pattern: "(^$)|(^-[a-z]$)"
description:
description: |
Description of the option.
The default value is an empty string.
type: string
type:
description: |
Type of the value that is assignable to this option.
The default value is "string".
$ref: '#/$defs/type'
default:
description: |
String value representing the default value of the option.
It must be a string that can be parsed as a value of the option type.
If not specified, the following values corresponding to the option type.
- boolean: "false"
- string: ""
- integer: "0"
- float: "0.0"
type: string
argument:
description: |
Argument represents a positional required argument in command line arguments.
type: object
properties:
name:
description: |
Name of the argument, which must match the regular expression `^[a-z][a-z0-9]*$` and be unique in arguments of the command which the argument belongs to.
This property is required.
type: string
pattern: "^[a-z][a-z0-9]*(_[a-z0-9]+)*$"
description:
description: |
Description of the argument.
The default value is an empty string.
type: string
type:
description: |
Type of the value that is assignable to the argument.
The default value is "string".
$ref: '#/$defs/type'
variadic:
description: |
Whether the argument is variadic (i.e. can have zero or more values).
It can be true only if this argument is the last argument in the arguments of the belonging command.
The default value is false.
type: boolean
required: [name]