/
config.schema.json
235 lines (235 loc) · 7.97 KB
/
config.schema.json
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
226
227
228
229
230
231
232
233
234
235
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/michenriksen/tmpl/config.schema.json",
"title": "Tmpl configuration",
"description": "A configuration file describing how a tmux session should be created.",
"version": "0.1.0",
"author": "Michael Henriksen",
"type": "object",
"$defs": {
"name": {
"title": "Name",
"description": "A name for the tmux session or window. Must only contain alphanumeric characters, underscores, dots, and dashes",
"type": "string",
"pattern": "^[\\w._-]+$"
},
"path": {
"title": "Path",
"description": "The directory path used as the working directory in a tmux session, window, or pane.\n\nThe paths are passed down from session to window to pane and can be customized at any level. If a path begins with '~', it will be automatically expanded to the current user's home directory.",
"type": "string",
"examples": [
"/path/to/project",
"~/path/to/project",
"relative/path/to/project"
]
},
"command": {
"title": "Shell command",
"description": "A shell command to run within a tmux window or pane.\n\nThe 'send-keys' tmux command is used to simulate the key presses. This means it can be used even when connected to a remote system via SSH or a similar connection.",
"type": "string",
"minLength": 1
},
"commands": {
"title": "Shell commands",
"description": "A list of shell commands to run within a tmux window or pane in the order they are listed.\n\nIf a command is also specified in the 'command' property, it will be run first.",
"type": "array",
"items": {
"$ref": "#/$defs/command"
},
"examples": [
[
"ssh user@host",
"cd /var/logs",
"tail -f app.log"
]
]
},
"env": {
"title": "Environment variables",
"description": "A list of environment variables to set in a tmux session, window, or pane.\n\nThese variables are passed down from the session to the window and can be customized at any level. Please note that variable names should consist of uppercase alphanumeric characters and underscores.",
"type": "object",
"propertyNames": {
"pattern": "^[A-Z_][A-Z0-9_]+$"
},
"additionalProperties": {
"type": [
"string",
"number",
"boolean"
]
},
"examples": [
{
"APP_ENV": "development",
"DEBUG": true,
"HTTP_PORT": 8080
}
]
},
"active": {
"title": "Active",
"description": "Whether a tmux window or pane should be selected after session creation. The first window and pane will be selected by default.",
"type": "boolean",
"default": false
},
"SessionConfig": {
"title": "Session configuration",
"description": "Session configuration describing how a tmux session should be created.",
"type": "object",
"properties": {
"name": {
"$ref": "#/$defs/name",
"default": "The current working directory base name."
},
"path": {
"$ref": "#/$defs/path",
"default": "The current working directory."
},
"env": {
"$ref": "#/$defs/env"
},
"on_window": {
"$ref": "#/$defs/command",
"title": "On-Window shell command",
"description": "A shell command to run first in all created windows. This is intended for any kind of project setup that should be run before any other commands. The command is run using the `send-keys` tmux command."
},
"on_pane": {
"$ref": "#/$defs/command",
"title": "On-Pane shell command",
"description": "A shell command to run first in all created panes. This is intended for any kind of project setup that should be run before any other commands. The command is run using the `send-keys` tmux command."
},
"on_any": {
"$ref": "#/$defs/command",
"title": "On-Window/Pane shell command",
"description": "A shell command to run first in all created windows and panes. This is intended for any kind of project setup that should be run before any other commands. The command is run using the `send-keys` tmux command."
},
"windows": {
"title": "Window configurations",
"description": "A list of tmux window configurations to create in the session. The first configuration will be used for the default window.",
"type": "array",
"items": {
"$ref": "#/$defs/WindowConfig"
}
}
},
"additionalProperties": false
},
"WindowConfig": {
"title": "Window configuration",
"description": "Window configuration describing how a tmux window should be created.",
"type": "object",
"properties": {
"name": {
"$ref": "#/$defs/name",
"default": "tmux default"
},
"path": {
"$ref": "#/$defs/path",
"default": "The session path."
},
"command": {
"$ref": "#/$defs/command"
},
"commands": {
"$ref": "#/$defs/commands"
},
"env": {
"$ref": "#/$defs/env",
"default": "The session env."
},
"active": {
"$ref": "#/$defs/active"
},
"panes": {
"title": "Pane configurations",
"description": "A list of tmux pane configurations to create in the window.",
"type": "array",
"items": {
"$ref": "#/$defs/PaneConfig"
}
},
"additionalProperties": false
}
},
"PaneConfig": {
"title": "Pane configuration",
"description": "Pane configuration describing how a tmux pane should be created.",
"type": "object",
"properties": {
"path": {
"$ref": "#/$defs/path",
"default": "The window path."
},
"command": {
"$ref": "#/$defs/command"
},
"commands": {
"$ref": "#/$defs/commands"
},
"env": {
"$ref": "#/$defs/env",
"default": "The window env."
},
"active": {
"$ref": "#/$defs/active"
},
"horizontal": {
"title": "Horizontal split",
"description": "Whether to split the window horizontally. If false, the window will be split vertically.",
"type": "boolean",
"default": false
},
"size": {
"title": "Size",
"description": "The size of the pane in lines for horizontal panes, or columns for vertical panes. The size can also be specified as a percentage of the available space.",
"type": "string",
"examples": [
"20%",
"50",
"215"
]
},
"panes": {
"title": "Pane configurations",
"description": "A list of tmux pane configurations to create in the pane.",
"type": "array",
"items": {
"$ref": "#/$defs/PaneConfig"
}
}
},
"additionalProperties": false
}
},
"properties": {
"tmux": {
"title": "tmux executable",
"description": "The tmux executable to use. Must be an absolute path, or available in $PATH.",
"type": "string",
"default": "tmux"
},
"tmux_options": {
"title": "tmux command line options",
"description": "Additional tmux command line options to add to all tmux command invocations.",
"type": "array",
"items": {
"type": "string",
"description": "A tmux command line flag and its value, if any. See `man tmux` for available options."
},
"examples": [
[
"-f",
"/path/to/tmux.conf"
],
[
"-L",
"MySocket"
]
]
},
"session": {
"$ref": "#/$defs/SessionConfig"
}
},
"additionalProperties": false
}