-
Notifications
You must be signed in to change notification settings - Fork 18
/
rules.schema.yaml
225 lines (222 loc) · 7.84 KB
/
rules.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
$id: http://example.com/example.json
$schema: http://json-schema.org/draft-07/schema
title: Antidot Rules
type: object
additionalProperties: false
description: antidot rules file
required:
- version
- rules
examples:
- version: 1
rules:
- name: rule-name
description: Rule description
notes:
- First note
- Second note
dotfile:
is_dir: false
name: .dotfile_name
actions:
- dest: /other/path
source: /some/path
type: migrate
- path: /some/path
type: delete
- key: ENV_KEY
type: export
value: env_value
- alias: alias
command: cmd --with=flag
type: alias
- version: 1
rules:
- name: rule-name
description: Rule description
dotfile:
name: .dotfile_name
actions:
- type: migrate
dest: /other/path
source: /some/path
- type: export
key: ENV_KEY
value: env_value
properties:
version:
$id: "#/properties/version"
default: 1
description: The rules file schema version.
title: Rules Schema Version
type: integer
rules:
$id: "#/properties/rules"
title: Rules
type: array
default: []
description: List of rules that match actions to dotfiles.
items:
$id: "#/properties/rules/items"
title: Rule
description: A rule that match actions to a dotfile.
required:
- name
- dotfile
- actions
type: object
additionalProperties: false
properties:
name:
$id: "#/properties/rules/items/properties/name"
default: ""
description: An explanation about the purpose of this instance.
examples:
- rule-name
title: The name schema
type: string
description:
$id: "#/properties/rules/items/properties/description"
default: ""
description: An explanation about the purpose of this instance.
examples:
- Rule description
title: The description schema
type: string
notes:
$id: "#/properties/rules/items/properties/notes"
title: Rules' Notes
type: array
default: []
description: A list of notes or warnings about the rule.
items:
$id: "#/properties/rules/items/properties/notes/items"
title: Rule Note
type: string
dotfile:
$id: "#/properties/rules/items/properties/dotfile"
additionalProperties: true
default: {}
description: An explanation about the purpose of this instance.
examples:
- is_dir: false
name: .dotfile_name
properties:
is_dir:
$id: "#/properties/rules/items/properties/dotfile/properties/is_dir"
default: false
description: An explanation about the purpose of this
instance.
examples:
- false
title: The is_dir schema
type: boolean
name:
$id: "#/properties/rules/items/properties/dotfile/properties/name"
default: ""
description: An explanation about the purpose of this
instance.
examples:
- .dotfile_name
title: The name schema
type: string
required:
- name
title: The dotfile schema
type: object
actions:
$id: "#/properties/rules/items/properties/actions"
title: Action List
type: array
default: []
description: Actions to run for a specific dotfile.
items:
$id: "#/properties/rules/items/properties/actions/items"
anyOf:
- $id: "#/properties/rules/items/properties/actions/items/migrate"
title: Migrate Action
description: Action to migrate a file to a new location.
type: object
required:
- type
- source
- dest
additionalProperties: false
properties:
type:
$id: "#/properties/rules/items/properties/actions/items/migrate/properties/type"
description: The action's type.
const: migrate
source:
$id: "#/properties/rules/items/properties/actions/items/migrate/properties/source"
description: Migrate file from this path.
examples:
- /some/path
type: string
dest:
$id: "#/properties/rules/items/properties/actions/items/migrate/properties/dest"
description: Migrate file to this path.
examples:
- /other/path
type: string
- $id: "#/properties/rules/items/properties/actions/items/delete"
title: Delete Action
description: Action to delete a file or directory.
required:
- type
- path
type: object
additionalProperties: false
properties:
type:
$id: "#/properties/rules/items/properties/actions/items/delete/properties/type"
description: The action's type.
const: delete
path:
$id: "#/properties/rules/items/properties/actions/items/delete/properties/path"
description: The file or directory path to delete.
type: string
- $id: "#/properties/rules/items/properties/actions/items/export"
title: Export Action
description: Action to export an environment variable.
additionalProperties: false
required:
- type
- key
- value
type: object
properties:
type:
$id: "#/properties/rules/items/properties/actions/items/export/properties/type"
description: The action's type.
const: export
key:
$id: "#/properties/rules/items/properties/actions/items/export/properties/key"
description: The environment variable name.
type: string
value:
$id: "#/properties/rules/items/properties/actions/items/export/properties/value"
description: The environment variable value.
type: string
- $id: "#/properties/rules/items/properties/actions/items/alias"
title: Alias Action
description: Action to declare a command alias.
required:
- type
- alias
- command
type: object
additionalProperties: false
properties:
type:
$id: "#/properties/rules/items/properties/actions/items/alias/properties/type"
description: The action's type.
const: alias
alias:
$id: "#/properties/rules/items/properties/actions/items/alias/properties/alias"
description: Alias name.
type: string
command:
$id: "#/properties/rules/items/properties/actions/items/alias/properties/command"
description: Alias value.
type: string