Skip to content

Commit

Permalink
Tests from old tabry
Browse files Browse the repository at this point in the history
Some are not passing, put in 'TODO' directory for now
  • Loading branch information
evanbattaglia committed Sep 5, 2024
1 parent 8693aa7 commit 02d2efb
Show file tree
Hide file tree
Showing 22 changed files with 629 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"cmd": null,
"main": {
"args": [
{
"name": "vehicle_type1"
},
{
"name": "vehicle_type3",
"description": "The type of vehicle"
},
{
"name": "vehicle_type4",
"description": "The type of vehicle"
},
{
"options": [
{
"type": "const",
"value": "a"
}
]
},
{
"name": "bool1",
"options": [
{
"type": "const",
"value": "T"
},
{
"type": "const",
"value": "F"
}
]
},
{
"name": "bool2",
"options": [
{
"type": "const",
"value": "T"
},
{
"type": "const",
"value": "F"
}
]
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
arg vehicle_type1
arg vehicle_type3 "The type of vehicle"
arg vehicle_type4 {
desc "The type of vehicle"
}
arg { opts const a }
arg (bool1 bool2) {
opts const T
opts const F
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"cmd": null,
"main": {
"subs": [
{
"name": "mycmd",
"description": "My command:\n * It does stuff"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sub mycmd {
desc "
My command:
* It does stuff
"
}
16 changes: 16 additions & 0 deletions fixtures/examples_from_language_reference/argument_titles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"cmd": null,
"main": {
"args": [
{
"name": "thing_to_search_for",
"title": "thing to search for"
},
{
"name": "files_to_load",
"title": "file to load",
"varargs": true
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
arg thing_to_search_for { title "thing to search for" }
varargs files_to_load { title "file to load" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"cmd": null,
"main": {
"flags": [
{
"name": "dry-run",
"aliases": [
"d"
]
},
{
"name": "dry-run2",
"aliases": [
"r"
],
"description": "Don't act, only show what would be done"
},
{
"name": "f",
"aliases": [
"format"
],
"arg": true,
"options": [
{
"type": "const",
"value": "json"
},
{
"type": "const",
"value": "yml"
}
]
},
{
"name": "env",
"aliases": [
"e"
],
"description": "The environment (this must be given)",
"arg": true,
"options": [
{
"type": "const",
"value": "prod"
},
{
"type": "const",
"value": "beta"
},
{
"type": "const",
"value": "dev"
}
]
},
{
"name": "interactive",
"aliases": [
"i"
]
},
{
"name": "force",
"aliases": [
"f"
]
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
flag dry-run,d
flag dry-run2,r "Don't act, only show what would be done"
flagarg f,format { opts const (json yml) }
flagarg env,e "The environment (this must be given)" {
opts const (prod beta dev)
}
flag (interactive,i force,f)
31 changes: 31 additions & 0 deletions fixtures/examples_from_language_reference/getting_started.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"cmd": "control-vehicle",
"main": {
"args": [
{
"options": [
{
"type": "const",
"value": "car"
},
{
"type": "const",
"value": "bike"
}
]
},
{
"options": [
{
"type": "const",
"value": "go"
},
{
"type": "const",
"value": "stop"
}
]
}
]
}
}
13 changes: 13 additions & 0 deletions fixtures/examples_from_language_reference/getting_started.tabry
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmd control-vehicle

# The vehicle argument
# Note: comments must be on a line of their own
arg {
opts const car
opts const bike
}

arg {
opts const go
opts const stop
}
129 changes: 129 additions & 0 deletions fixtures/examples_from_language_reference/includes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"cmd": "mydeploy",
"main": {
"args": [
{
"include": "project-and-environment"
}
],
"flags": [
{
"include": "project-and-environment"
}
],
"subs": [
{
"include": "project-and-environment"
},
{
"name": "status",
"args": [
{
"include": "project-and-environment"
},
{
"include": "verbose"
}
],
"flags": [
{
"include": "project-and-environment"
},
{
"include": "verbose"
}
],
"subs": [
{
"include": "project-and-environment"
},
{
"include": "verbose"
}
]
},
{
"name": "list",
"args": [
{
"include": "verbose"
}
],
"flags": [
{
"include": "verbose"
},
{
"name": "env",
"options": [
{
"type": "include",
"value": "environment"
}
],
"arg": true
}
],
"subs": [
{
"include": "verbose"
}
]
}
]
},
"option_includes": {
"environment": [
{
"type": "const",
"value": "prod"
},
{
"type": "const",
"value": "beta"
},
{
"type": "const",
"value": "dev"
}
]
},
"arg_includes": {
"verbose": {
"flags": [
{
"name": "verbose",
"description": "Show more info"
}
]
},
"project-and-environment": {
"args": [
{
"name": "project",
"description": "The project",
"options": [
{
"type": "const",
"value": "project1"
},
{
"type": "const",
"value": "project2"
}
]
},
{
"name": "environment",
"options": [
{
"type": "include",
"value": "environment"
}
],
"description": "The environment"
}
]
}
}
}
25 changes: 25 additions & 0 deletions fixtures/examples_from_language_reference/includes.tabry
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmd mydeploy

# Default command acts on project-and-environment
include @project-and-environment

# status command acts and project-and-environment as well
sub status @project-and-environment @verbose

# list command takes no position args, but takes an optional "env" flag
sub list @verbose {
flagarg env @environment
}

defopts @environment {
opts const (prod beta dev)
}

defargs @verbose {
flag verbose "Show more info"
}

defargs @project-and-environment {
arg project "The project" { opts const (project1 project2) }
arg environment "The environment" @environment
}
Loading

0 comments on commit 02d2efb

Please sign in to comment.