mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-10 07:04:17 +00:00
chore: make run-examples available on all platforms (#429)
* Make examples available for all platforms * limit windows to crossterm_demo only and make q exit demos work
This commit is contained in:
parent
74243394d9
commit
4ec902b96f
1 changed files with 45 additions and 14 deletions
|
@ -92,20 +92,51 @@ args = [
|
|||
"--examples",
|
||||
]
|
||||
|
||||
[tasks.run-example]
|
||||
private = true
|
||||
condition = { env_set = ["TUI_EXAMPLE_NAME", "TUI_FEATURES"] }
|
||||
command = "cargo"
|
||||
args = [
|
||||
"run",
|
||||
"--features",
|
||||
"${TUI_FEATURES}",
|
||||
"--release",
|
||||
"--example",
|
||||
"${TUI_EXAMPLE_NAME}"
|
||||
]
|
||||
|
||||
[tasks.run-example-windows]
|
||||
private = true
|
||||
condition = { env = {"TUI_EXAMPLE_NAME" = "crossterm_demo"} }
|
||||
run_task = "run-example"
|
||||
|
||||
[tasks.run-example-router]
|
||||
private = true
|
||||
run_task = [
|
||||
{ name = "run-example-windows", condition = { platforms = ["window"] } },
|
||||
{ name = "run-example" }
|
||||
]
|
||||
|
||||
[tasks.build-examples]
|
||||
condition = { env_set = ["TUI_FEATURES"] }
|
||||
command = "cargo"
|
||||
args = [
|
||||
"build",
|
||||
"--examples",
|
||||
"--features",
|
||||
"${TUI_FEATURES}",
|
||||
"--release"
|
||||
]
|
||||
|
||||
[tasks.run-examples]
|
||||
linux_alias = "run-examples-unix"
|
||||
mac_alias = "run-examples-unix"
|
||||
windows_alias = "run-examples-windows"
|
||||
|
||||
[tasks.run-examples-unix]
|
||||
dependencies = ["build-examples"]
|
||||
script = '''
|
||||
#!/usr/bin/env bash
|
||||
cargo build --examples --features ${TUI_FEATURES} --release
|
||||
for file in examples/*.rs; do
|
||||
name="$(basename "${file/.rs/}")"
|
||||
cargo run --features ${TUI_FEATURES} --release --example "${name}"
|
||||
done
|
||||
#!@duckscript
|
||||
files = glob_array ./examples/*.rs
|
||||
for file in ${files}
|
||||
name = basename ${file}
|
||||
name = substring ${name} -3
|
||||
set_env TUI_EXAMPLE_NAME ${name}
|
||||
cm_run_task run-example-router
|
||||
end
|
||||
'''
|
||||
|
||||
[tasks.run-examples-windows]
|
||||
# TODO
|
||||
|
|
Loading…
Reference in a new issue