Add specification for all examples in Cargo.toml

pull/12/head
Florian Dehau 7 years ago
parent 28f0a8f216
commit fd1e1f22af

@ -29,7 +29,55 @@ rustbox = { version = "0.9.0", optional = true }
log4rs = "0.5.2"
rand = "0.3.15"
[[example]]
name = "barchart"
path = "examples/barchart.rs"
[[example]]
name = "block"
path = "examples/block.rs"
[[example]]
name = "canvas"
path = "examples/canvas.rs"
[[example]]
name = "chart"
path = "examples/chart.rs"
[[example]]
name = "custom_widget"
path = "examples/custom_widget.rs"
[[example]]
name = "demo"
path = "examples/demo.rs"
[[example]]
name = "gauge"
path = "examples/gauge.rs"
[[example]]
name = "list"
path = "examples/list.rs"
[[example]]
name = "paragraph"
path = "examples/paragraph.rs"
[[example]]
name = "rustbox"
path = "examples/rustbox.rs"
required-features = ["rustbox"]
[[example]]
name = "sparkline"
path = "examples/sparkline.rs"
[[example]]
name = "table"
path = "examples/table.rs"
[[example]]
name = "tabs"
path = "examples/tabs.rs"

@ -79,7 +79,6 @@ check: ## Validate the project code
build: ## Build the project in debug mode
$(CARGO) build $(CARGO_FLAGS)
release: CARGO_FLAGS += --release
release: build ## Build the project in release mode

@ -263,6 +263,7 @@ fn main() {
}
}
terminal.show_cursor().unwrap();
terminal.clear().unwrap();
}
fn draw(t: &mut Terminal<TermionBackend>, app: &App) -> Result<(), io::Error> {

@ -0,0 +1,15 @@
#!/bin/bash
# Build all examples in examples directory
set -eu -o pipefail
for file in examples/*.rs; do
name=$(basename ${file//.rs/})
echo "[EXAMPLE] $name"
if [[ "$name" == "rustbox" ]]; then
cargo build --features rustbox --example "$name"
else
cargo build --example "$name"
fi
done

@ -0,0 +1,14 @@
#!/bin/bash
# Run all examples in examples directory
set -eu -o pipefail
for file in examples/*.rs; do
name=$(basename ${file//.rs/})
if [[ "$name" == "rustbox" ]]; then
cargo run --features rustbox --example "$name"
else
cargo run --example "$name"
fi
done
Loading…
Cancel
Save