Skip to content

Commit 02d2efb

Browse files
committed
Tests from old tabry
Some are not passing, put in 'TODO' directory for now
1 parent 8693aa7 commit 02d2efb

22 files changed

+629
-2
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"cmd": null,
3+
"main": {
4+
"args": [
5+
{
6+
"name": "vehicle_type1"
7+
},
8+
{
9+
"name": "vehicle_type3",
10+
"description": "The type of vehicle"
11+
},
12+
{
13+
"name": "vehicle_type4",
14+
"description": "The type of vehicle"
15+
},
16+
{
17+
"options": [
18+
{
19+
"type": "const",
20+
"value": "a"
21+
}
22+
]
23+
},
24+
{
25+
"name": "bool1",
26+
"options": [
27+
{
28+
"type": "const",
29+
"value": "T"
30+
},
31+
{
32+
"type": "const",
33+
"value": "F"
34+
}
35+
]
36+
},
37+
{
38+
"name": "bool2",
39+
"options": [
40+
{
41+
"type": "const",
42+
"value": "T"
43+
},
44+
{
45+
"type": "const",
46+
"value": "F"
47+
}
48+
]
49+
}
50+
]
51+
}
52+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
arg vehicle_type1
2+
arg vehicle_type3 "The type of vehicle"
3+
arg vehicle_type4 {
4+
desc "The type of vehicle"
5+
}
6+
arg { opts const a }
7+
arg (bool1 bool2) {
8+
opts const T
9+
opts const F
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"cmd": null,
3+
"main": {
4+
"subs": [
5+
{
6+
"name": "mycmd",
7+
"description": "My command:\n * It does stuff"
8+
}
9+
]
10+
}
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sub mycmd {
2+
desc "
3+
My command:
4+
* It does stuff
5+
"
6+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"cmd": null,
3+
"main": {
4+
"args": [
5+
{
6+
"name": "thing_to_search_for",
7+
"title": "thing to search for"
8+
},
9+
{
10+
"name": "files_to_load",
11+
"title": "file to load",
12+
"varargs": true
13+
}
14+
]
15+
}
16+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
arg thing_to_search_for { title "thing to search for" }
2+
varargs files_to_load { title "file to load" }
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"cmd": null,
3+
"main": {
4+
"flags": [
5+
{
6+
"name": "dry-run",
7+
"aliases": [
8+
"d"
9+
]
10+
},
11+
{
12+
"name": "dry-run2",
13+
"aliases": [
14+
"r"
15+
],
16+
"description": "Don't act, only show what would be done"
17+
},
18+
{
19+
"name": "f",
20+
"aliases": [
21+
"format"
22+
],
23+
"arg": true,
24+
"options": [
25+
{
26+
"type": "const",
27+
"value": "json"
28+
},
29+
{
30+
"type": "const",
31+
"value": "yml"
32+
}
33+
]
34+
},
35+
{
36+
"name": "env",
37+
"aliases": [
38+
"e"
39+
],
40+
"description": "The environment (this must be given)",
41+
"arg": true,
42+
"options": [
43+
{
44+
"type": "const",
45+
"value": "prod"
46+
},
47+
{
48+
"type": "const",
49+
"value": "beta"
50+
},
51+
{
52+
"type": "const",
53+
"value": "dev"
54+
}
55+
]
56+
},
57+
{
58+
"name": "interactive",
59+
"aliases": [
60+
"i"
61+
]
62+
},
63+
{
64+
"name": "force",
65+
"aliases": [
66+
"f"
67+
]
68+
}
69+
]
70+
}
71+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
flag dry-run,d
2+
flag dry-run2,r "Don't act, only show what would be done"
3+
flagarg f,format { opts const (json yml) }
4+
flagarg env,e "The environment (this must be given)" {
5+
opts const (prod beta dev)
6+
}
7+
flag (interactive,i force,f)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"cmd": "control-vehicle",
3+
"main": {
4+
"args": [
5+
{
6+
"options": [
7+
{
8+
"type": "const",
9+
"value": "car"
10+
},
11+
{
12+
"type": "const",
13+
"value": "bike"
14+
}
15+
]
16+
},
17+
{
18+
"options": [
19+
{
20+
"type": "const",
21+
"value": "go"
22+
},
23+
{
24+
"type": "const",
25+
"value": "stop"
26+
}
27+
]
28+
}
29+
]
30+
}
31+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmd control-vehicle
2+
3+
# The vehicle argument
4+
# Note: comments must be on a line of their own
5+
arg {
6+
opts const car
7+
opts const bike
8+
}
9+
10+
arg {
11+
opts const go
12+
opts const stop
13+
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"cmd": "mydeploy",
3+
"main": {
4+
"args": [
5+
{
6+
"include": "project-and-environment"
7+
}
8+
],
9+
"flags": [
10+
{
11+
"include": "project-and-environment"
12+
}
13+
],
14+
"subs": [
15+
{
16+
"include": "project-and-environment"
17+
},
18+
{
19+
"name": "status",
20+
"args": [
21+
{
22+
"include": "project-and-environment"
23+
},
24+
{
25+
"include": "verbose"
26+
}
27+
],
28+
"flags": [
29+
{
30+
"include": "project-and-environment"
31+
},
32+
{
33+
"include": "verbose"
34+
}
35+
],
36+
"subs": [
37+
{
38+
"include": "project-and-environment"
39+
},
40+
{
41+
"include": "verbose"
42+
}
43+
]
44+
},
45+
{
46+
"name": "list",
47+
"args": [
48+
{
49+
"include": "verbose"
50+
}
51+
],
52+
"flags": [
53+
{
54+
"include": "verbose"
55+
},
56+
{
57+
"name": "env",
58+
"options": [
59+
{
60+
"type": "include",
61+
"value": "environment"
62+
}
63+
],
64+
"arg": true
65+
}
66+
],
67+
"subs": [
68+
{
69+
"include": "verbose"
70+
}
71+
]
72+
}
73+
]
74+
},
75+
"option_includes": {
76+
"environment": [
77+
{
78+
"type": "const",
79+
"value": "prod"
80+
},
81+
{
82+
"type": "const",
83+
"value": "beta"
84+
},
85+
{
86+
"type": "const",
87+
"value": "dev"
88+
}
89+
]
90+
},
91+
"arg_includes": {
92+
"verbose": {
93+
"flags": [
94+
{
95+
"name": "verbose",
96+
"description": "Show more info"
97+
}
98+
]
99+
},
100+
"project-and-environment": {
101+
"args": [
102+
{
103+
"name": "project",
104+
"description": "The project",
105+
"options": [
106+
{
107+
"type": "const",
108+
"value": "project1"
109+
},
110+
{
111+
"type": "const",
112+
"value": "project2"
113+
}
114+
]
115+
},
116+
{
117+
"name": "environment",
118+
"options": [
119+
{
120+
"type": "include",
121+
"value": "environment"
122+
}
123+
],
124+
"description": "The environment"
125+
}
126+
]
127+
}
128+
}
129+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmd mydeploy
2+
3+
# Default command acts on project-and-environment
4+
include @project-and-environment
5+
6+
# status command acts and project-and-environment as well
7+
sub status @project-and-environment @verbose
8+
9+
# list command takes no position args, but takes an optional "env" flag
10+
sub list @verbose {
11+
flagarg env @environment
12+
}
13+
14+
defopts @environment {
15+
opts const (prod beta dev)
16+
}
17+
18+
defargs @verbose {
19+
flag verbose "Show more info"
20+
}
21+
22+
defargs @project-and-environment {
23+
arg project "The project" { opts const (project1 project2) }
24+
arg environment "The environment" @environment
25+
}

0 commit comments

Comments
 (0)