tabry 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tabry/shells/bash.rb +12 -5
- data/sh/bash/README.md +2 -1
- data/tabry.gemspec +19 -2
- data/treesitter/Cargo.toml +26 -0
- data/treesitter/README.md +4 -0
- data/treesitter/binding.gyp +19 -0
- data/treesitter/bindings/node/binding.cc +28 -0
- data/treesitter/bindings/node/index.js +19 -0
- data/treesitter/bindings/rust/build.rs +40 -0
- data/treesitter/bindings/rust/lib.rs +52 -0
- data/treesitter/corpus/arg.txt +96 -0
- data/treesitter/corpus/at.txt +79 -0
- data/treesitter/corpus/comment.txt +13 -0
- data/treesitter/corpus/desc.txt +25 -0
- data/treesitter/corpus/examples_from_language_reference.txt +410 -0
- data/treesitter/corpus/flag.txt +48 -0
- data/treesitter/corpus/flag_desc_inline.txt +37 -0
- data/treesitter/corpus/opts.txt +21 -0
- data/treesitter/corpus/rapture.txt +61 -0
- data/treesitter/grammar.js +171 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/argument_titles.yml +8 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/arguments_and_possible_options__arg_.yml +23 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/flags__flag__flagarg__reqd_flagarg_.yml +37 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/getting_started.yml +13 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/includes.yml +57 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/multi_line_descriptions.yml +7 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/optional_args_and_varargs__opt_arg__varargs__opt_varargs_.yml +16 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/options.yml +24 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/subcommands__sub__1.yml +23 -0
- data/treesitter/jest_fixtures/examples_from_language_reference/subcommands__sub__2.yml +15 -0
- data/treesitter/package.json +21 -0
- data/treesitter/parser_compile.sh +1 -0
- data/treesitter/src/grammar.json +615 -0
- data/treesitter/src/node-types.json +563 -0
- data/treesitter/src/parser.c +4706 -0
- data/treesitter/src/tree_sitter/parser.h +223 -0
- data/treesitter/tabry-compile.js +394 -0
- data/treesitter/tabry-compile.test.js +51 -0
- metadata +36 -1
@@ -0,0 +1,410 @@
|
|
1
|
+
===============
|
2
|
+
Getting started
|
3
|
+
===============
|
4
|
+
cmd control-vehicle
|
5
|
+
|
6
|
+
# The vehicle argument
|
7
|
+
# Note: comments must be on a line of their own
|
8
|
+
arg {
|
9
|
+
opts const car
|
10
|
+
opts const bike
|
11
|
+
}
|
12
|
+
|
13
|
+
arg {
|
14
|
+
opts const go
|
15
|
+
opts const stop
|
16
|
+
}
|
17
|
+
|
18
|
+
---
|
19
|
+
|
20
|
+
(source_file
|
21
|
+
(cmd_statement (string))
|
22
|
+
(arg_statement
|
23
|
+
(arg_type)
|
24
|
+
(block
|
25
|
+
(opts_const_statement (string))
|
26
|
+
(opts_const_statement (string))
|
27
|
+
)
|
28
|
+
)
|
29
|
+
(arg_statement
|
30
|
+
(arg_type)
|
31
|
+
(block
|
32
|
+
(opts_const_statement (string))
|
33
|
+
(opts_const_statement (string))
|
34
|
+
)
|
35
|
+
)
|
36
|
+
)
|
37
|
+
|
38
|
+
|
39
|
+
====================================
|
40
|
+
Arguments and possible options (arg)
|
41
|
+
====================================
|
42
|
+
arg vehicle_type1
|
43
|
+
arg vehicle_type3 "The type of vehicle"
|
44
|
+
arg vehicle_type4 {
|
45
|
+
desc "The type of vehicle"
|
46
|
+
}
|
47
|
+
arg { opts const a }
|
48
|
+
arg (bool1 bool2) {
|
49
|
+
opts const T
|
50
|
+
opts const F
|
51
|
+
}
|
52
|
+
|
53
|
+
---
|
54
|
+
|
55
|
+
(source_file
|
56
|
+
(arg_statement
|
57
|
+
(arg_type)
|
58
|
+
(arg_name_list (string))
|
59
|
+
)
|
60
|
+
(arg_statement
|
61
|
+
(arg_type)
|
62
|
+
(arg_name_list (string))
|
63
|
+
(string)
|
64
|
+
)
|
65
|
+
(arg_statement
|
66
|
+
(arg_type)
|
67
|
+
(arg_name_list (string))
|
68
|
+
(block
|
69
|
+
(desc_statement (string))
|
70
|
+
)
|
71
|
+
)
|
72
|
+
(arg_statement
|
73
|
+
(arg_type)
|
74
|
+
(block
|
75
|
+
(opts_const_statement (string))
|
76
|
+
)
|
77
|
+
)
|
78
|
+
(arg_statement
|
79
|
+
(arg_type)
|
80
|
+
(arg_name_list
|
81
|
+
(string)
|
82
|
+
(string)
|
83
|
+
)
|
84
|
+
(block
|
85
|
+
(opts_const_statement (string))
|
86
|
+
(opts_const_statement (string))
|
87
|
+
)
|
88
|
+
)
|
89
|
+
)
|
90
|
+
|
91
|
+
=======
|
92
|
+
Options
|
93
|
+
=======
|
94
|
+
arg {
|
95
|
+
opts const hello
|
96
|
+
opts const "hello \"world\""
|
97
|
+
opts const (T F true false yes no)
|
98
|
+
opts shell "mycmd list-things"
|
99
|
+
opts file
|
100
|
+
opts dir
|
101
|
+
}
|
102
|
+
|
103
|
+
---
|
104
|
+
|
105
|
+
(source_file
|
106
|
+
(arg_statement
|
107
|
+
(arg_type)
|
108
|
+
(block
|
109
|
+
(opts_const_statement (string))
|
110
|
+
(opts_const_statement (string))
|
111
|
+
(opts_const_statement (string) (string) (string) (string) (string) (string))
|
112
|
+
(opts_shell_statement (string))
|
113
|
+
(opts_file_statement)
|
114
|
+
(opts_dir_statement)
|
115
|
+
)
|
116
|
+
)
|
117
|
+
)
|
118
|
+
|
119
|
+
=========================================================
|
120
|
+
Optional args and Varargs (opt arg, varargs, opt varargs)
|
121
|
+
=========================================================
|
122
|
+
arg first-arg-mandatory
|
123
|
+
opt arg second-arg-optional
|
124
|
+
opt varargs rest-args-optional { opts const (foo bar waz) }
|
125
|
+
|
126
|
+
---
|
127
|
+
|
128
|
+
(source_file
|
129
|
+
(arg_statement
|
130
|
+
(arg_type)
|
131
|
+
(arg_name_list (string))
|
132
|
+
)
|
133
|
+
(arg_statement
|
134
|
+
(arg_modifier)
|
135
|
+
(arg_type)
|
136
|
+
(arg_name_list (string))
|
137
|
+
)
|
138
|
+
(arg_statement
|
139
|
+
(arg_modifier)
|
140
|
+
(arg_type)
|
141
|
+
(arg_name_list (string))
|
142
|
+
(block
|
143
|
+
(opts_const_statement (string) (string) (string))
|
144
|
+
)
|
145
|
+
)
|
146
|
+
)
|
147
|
+
|
148
|
+
===============
|
149
|
+
Argument titles
|
150
|
+
===============
|
151
|
+
arg thing_to_search_for { title "thing to search for" }
|
152
|
+
varargs files_to_load { title "file to load" }
|
153
|
+
|
154
|
+
---
|
155
|
+
|
156
|
+
(source_file
|
157
|
+
(arg_statement
|
158
|
+
(arg_type)
|
159
|
+
(arg_name_list (string))
|
160
|
+
(block
|
161
|
+
(title_statement (string))
|
162
|
+
)
|
163
|
+
)
|
164
|
+
(arg_statement
|
165
|
+
(arg_type)
|
166
|
+
(arg_name_list (string))
|
167
|
+
(block
|
168
|
+
(title_statement (string))
|
169
|
+
)
|
170
|
+
)
|
171
|
+
)
|
172
|
+
|
173
|
+
===================================
|
174
|
+
Flags (flag, flagarg, reqd flagarg)
|
175
|
+
===================================
|
176
|
+
flag dry-run,d
|
177
|
+
flag dry-run2,r "Don't act, only show what would be done"
|
178
|
+
flagarg f,format { opts const (json yml) }
|
179
|
+
flagarg env,e "The environment (this must be given)" {
|
180
|
+
opts const (prod beta dev)
|
181
|
+
}
|
182
|
+
flag (interactive,i force,f)
|
183
|
+
|
184
|
+
---
|
185
|
+
|
186
|
+
(source_file
|
187
|
+
(flag_statement
|
188
|
+
(flag_name_list (string))
|
189
|
+
)
|
190
|
+
(flag_statement
|
191
|
+
(flag_name_list (string))
|
192
|
+
(string)
|
193
|
+
)
|
194
|
+
(flagarg_statement
|
195
|
+
(flag_name_list (string))
|
196
|
+
(block
|
197
|
+
(opts_const_statement (string) (string))
|
198
|
+
)
|
199
|
+
)
|
200
|
+
(flagarg_statement
|
201
|
+
(flag_name_list (string))
|
202
|
+
(string)
|
203
|
+
(block
|
204
|
+
(opts_const_statement (string) (string) (string))
|
205
|
+
)
|
206
|
+
)
|
207
|
+
(flag_statement
|
208
|
+
(flag_name_list
|
209
|
+
(string)
|
210
|
+
(string)
|
211
|
+
)
|
212
|
+
)
|
213
|
+
)
|
214
|
+
|
215
|
+
===================
|
216
|
+
Subcommands (sub) 1
|
217
|
+
===================
|
218
|
+
sub list "List the things"
|
219
|
+
sub new,n "Create a thing"
|
220
|
+
sub delete,d {
|
221
|
+
desc "Delete a thing"
|
222
|
+
arg thing "The thing to delete" { opts shell "mycmd list" }
|
223
|
+
}
|
224
|
+
sub (do-something do-something-else,dse)
|
225
|
+
|
226
|
+
---
|
227
|
+
|
228
|
+
(source_file
|
229
|
+
(sub_statement
|
230
|
+
(sub_name_list (string))
|
231
|
+
(string)
|
232
|
+
)
|
233
|
+
(sub_statement
|
234
|
+
(sub_name_list (string))
|
235
|
+
(string)
|
236
|
+
)
|
237
|
+
(sub_statement
|
238
|
+
(sub_name_list (string))
|
239
|
+
(block
|
240
|
+
(desc_statement (string))
|
241
|
+
(arg_statement
|
242
|
+
(arg_type)
|
243
|
+
(arg_name_list (string))
|
244
|
+
(string)
|
245
|
+
(block
|
246
|
+
(opts_shell_statement (string))
|
247
|
+
)
|
248
|
+
)
|
249
|
+
)
|
250
|
+
)
|
251
|
+
(sub_statement
|
252
|
+
(sub_name_list
|
253
|
+
(string)
|
254
|
+
(string)
|
255
|
+
)
|
256
|
+
)
|
257
|
+
)
|
258
|
+
|
259
|
+
===================
|
260
|
+
Subcommands (sub) 2
|
261
|
+
===================
|
262
|
+
cmd foo
|
263
|
+
arg toplevel-arg
|
264
|
+
|
265
|
+
flag dryrun
|
266
|
+
|
267
|
+
sub mysub1 {
|
268
|
+
sub mysub2 {
|
269
|
+
flag someopt
|
270
|
+
opt arg mysub2-arg
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
---
|
275
|
+
|
276
|
+
(source_file
|
277
|
+
(cmd_statement (string))
|
278
|
+
(arg_statement
|
279
|
+
(arg_type)
|
280
|
+
(arg_name_list (string))
|
281
|
+
)
|
282
|
+
(flag_statement
|
283
|
+
(flag_name_list (string))
|
284
|
+
)
|
285
|
+
(sub_statement
|
286
|
+
(sub_name_list (string))
|
287
|
+
(block
|
288
|
+
(sub_statement
|
289
|
+
(sub_name_list (string))
|
290
|
+
(block
|
291
|
+
(flag_statement
|
292
|
+
(flag_name_list (string))
|
293
|
+
)
|
294
|
+
(arg_statement
|
295
|
+
(arg_modifier)
|
296
|
+
(arg_type)
|
297
|
+
(arg_name_list (string))
|
298
|
+
)
|
299
|
+
)
|
300
|
+
)
|
301
|
+
)
|
302
|
+
)
|
303
|
+
)
|
304
|
+
|
305
|
+
========
|
306
|
+
Includes
|
307
|
+
========
|
308
|
+
cmd mydeploy
|
309
|
+
|
310
|
+
# Default command acts on project-and-environment
|
311
|
+
include @project-and-environment
|
312
|
+
|
313
|
+
# status command acts and project-and-environment as well
|
314
|
+
sub status @project-and-environment @verbose
|
315
|
+
|
316
|
+
# list command takes no position args, but takes an optional "env" flag
|
317
|
+
sub list @verbose {
|
318
|
+
flagarg env @environment
|
319
|
+
}
|
320
|
+
|
321
|
+
defopts @environment {
|
322
|
+
opts const (prod beta dev)
|
323
|
+
}
|
324
|
+
|
325
|
+
defargs @verbose {
|
326
|
+
flag verbose "Show more info"
|
327
|
+
}
|
328
|
+
|
329
|
+
defargs @project-and-environment {
|
330
|
+
arg project "The project" { opts const (project1 project2) }
|
331
|
+
arg environment "The environment" @environment
|
332
|
+
}
|
333
|
+
|
334
|
+
---
|
335
|
+
|
336
|
+
(source_file
|
337
|
+
(cmd_statement (string))
|
338
|
+
(include_statement (at_identifier))
|
339
|
+
(sub_statement
|
340
|
+
(sub_name_list (string))
|
341
|
+
(at_identifier)
|
342
|
+
(at_identifier)
|
343
|
+
)
|
344
|
+
(sub_statement
|
345
|
+
(sub_name_list (string))
|
346
|
+
(at_identifier)
|
347
|
+
(block
|
348
|
+
(flagarg_statement
|
349
|
+
(flag_name_list (string))
|
350
|
+
(at_identifier)
|
351
|
+
)
|
352
|
+
)
|
353
|
+
)
|
354
|
+
(defopts_statement
|
355
|
+
(at_identifier)
|
356
|
+
(block
|
357
|
+
(opts_const_statement (string) (string) (string))
|
358
|
+
)
|
359
|
+
)
|
360
|
+
(defargs_statement
|
361
|
+
(at_identifier)
|
362
|
+
(block
|
363
|
+
(flag_statement
|
364
|
+
(flag_name_list (string))
|
365
|
+
(string)
|
366
|
+
)
|
367
|
+
)
|
368
|
+
)
|
369
|
+
(defargs_statement
|
370
|
+
(at_identifier)
|
371
|
+
(block
|
372
|
+
(arg_statement
|
373
|
+
(arg_type)
|
374
|
+
(arg_name_list (string))
|
375
|
+
(string)
|
376
|
+
(block
|
377
|
+
(opts_const_statement (string) (string))
|
378
|
+
)
|
379
|
+
)
|
380
|
+
(arg_statement
|
381
|
+
(arg_type)
|
382
|
+
(arg_name_list (string))
|
383
|
+
(string)
|
384
|
+
(at_identifier)
|
385
|
+
)
|
386
|
+
)
|
387
|
+
)
|
388
|
+
)
|
389
|
+
|
390
|
+
=======================
|
391
|
+
Multi-line descriptions
|
392
|
+
=======================
|
393
|
+
sub mycmd {
|
394
|
+
desc "
|
395
|
+
My command:
|
396
|
+
* It does stuff
|
397
|
+
"
|
398
|
+
}
|
399
|
+
|
400
|
+
---
|
401
|
+
|
402
|
+
(source_file
|
403
|
+
(sub_statement
|
404
|
+
(sub_name_list (string))
|
405
|
+
(block
|
406
|
+
(desc_statement (string))
|
407
|
+
)
|
408
|
+
)
|
409
|
+
)
|
410
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
============
|
2
|
+
Simple Flags
|
3
|
+
============
|
4
|
+
|
5
|
+
flagarg foo
|
6
|
+
flagarg bar
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
(source_file
|
11
|
+
(flagarg_statement (flag_name_list (string)))
|
12
|
+
(flagarg_statement (flag_name_list (string))))
|
13
|
+
|
14
|
+
================
|
15
|
+
Flags with block
|
16
|
+
================
|
17
|
+
|
18
|
+
flagarg foo {
|
19
|
+
flagarg wombat
|
20
|
+
}
|
21
|
+
|
22
|
+
---
|
23
|
+
|
24
|
+
(source_file
|
25
|
+
(flagarg_statement
|
26
|
+
(flag_name_list (string))
|
27
|
+
(block
|
28
|
+
(flagarg_statement
|
29
|
+
(flag_name_list (string))))))
|
30
|
+
|
31
|
+
================
|
32
|
+
Flags with modifier
|
33
|
+
================
|
34
|
+
|
35
|
+
reqd flagarg foo {
|
36
|
+
flagarg wombat
|
37
|
+
}
|
38
|
+
|
39
|
+
---
|
40
|
+
|
41
|
+
(source_file
|
42
|
+
(flagarg_statement
|
43
|
+
(flag_modifier)
|
44
|
+
(flag_name_list (string))
|
45
|
+
(block
|
46
|
+
(flagarg_statement
|
47
|
+
(flag_name_list (string))))))
|
48
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
==========
|
2
|
+
Flag no inline desc
|
3
|
+
==========
|
4
|
+
|
5
|
+
flag foo
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
(source_file
|
10
|
+
(flag_statement
|
11
|
+
names: (flag_name_list (string))))
|
12
|
+
|
13
|
+
==========
|
14
|
+
Flag inline desc
|
15
|
+
==========
|
16
|
+
|
17
|
+
flag foo "Some desc"
|
18
|
+
|
19
|
+
---
|
20
|
+
|
21
|
+
(source_file
|
22
|
+
(flag_statement
|
23
|
+
names: (flag_name_list (string))
|
24
|
+
desc: (string)))
|
25
|
+
|
26
|
+
==========
|
27
|
+
Flag inline desc multiple names
|
28
|
+
==========
|
29
|
+
|
30
|
+
flag (foo bar) "Some desc"
|
31
|
+
|
32
|
+
---
|
33
|
+
|
34
|
+
(source_file
|
35
|
+
(flag_statement
|
36
|
+
names: (flag_name_list (string) (string))
|
37
|
+
desc: (string)))
|
@@ -0,0 +1,21 @@
|
|
1
|
+
============
|
2
|
+
Options
|
3
|
+
============
|
4
|
+
|
5
|
+
arg {
|
6
|
+
opts const a
|
7
|
+
opts shell "ls"
|
8
|
+
opts file
|
9
|
+
opts dir
|
10
|
+
}
|
11
|
+
|
12
|
+
---
|
13
|
+
|
14
|
+
(source_file
|
15
|
+
(arg_statement
|
16
|
+
(arg_type)
|
17
|
+
(block
|
18
|
+
(opts_const_statement (string))
|
19
|
+
(opts_shell_statement (string))
|
20
|
+
(opts_file_statement)
|
21
|
+
(opts_dir_statement))))
|
@@ -0,0 +1,61 @@
|
|
1
|
+
====================
|
2
|
+
Rapture part 1
|
3
|
+
====================
|
4
|
+
|
5
|
+
cmd rapture
|
6
|
+
sub (init whoami account)
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
(source_file
|
11
|
+
(cmd_statement (string))
|
12
|
+
(sub_statement
|
13
|
+
(sub_name_list
|
14
|
+
(string)
|
15
|
+
(string)
|
16
|
+
(string))
|
17
|
+
)
|
18
|
+
)
|
19
|
+
|
20
|
+
|
21
|
+
====================
|
22
|
+
Rapture full example
|
23
|
+
====================
|
24
|
+
|
25
|
+
cmd rapture
|
26
|
+
sub (init whoami account)
|
27
|
+
|
28
|
+
sub (assume wrap) { arg @role }
|
29
|
+
defopts @role { opts shell "rapture role ls|awk '{print $2}'" }
|
30
|
+
|
31
|
+
---
|
32
|
+
|
33
|
+
(source_file
|
34
|
+
(cmd_statement (string))
|
35
|
+
(sub_statement
|
36
|
+
(sub_name_list
|
37
|
+
(string)
|
38
|
+
(string)
|
39
|
+
(string))
|
40
|
+
)
|
41
|
+
(sub_statement
|
42
|
+
(sub_name_list
|
43
|
+
(string)
|
44
|
+
(string))
|
45
|
+
(block
|
46
|
+
(arg_statement
|
47
|
+
(arg_type)
|
48
|
+
(at_identifier)
|
49
|
+
)
|
50
|
+
)
|
51
|
+
)
|
52
|
+
(defopts_statement
|
53
|
+
(at_identifier)
|
54
|
+
(block
|
55
|
+
(opts_shell_statement (string))
|
56
|
+
|
57
|
+
)
|
58
|
+
)
|
59
|
+
)
|
60
|
+
|
61
|
+
|