mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-10 07:04:17 +00:00
8d507c43fa
Windows 7 doesn't support the underline color attribute, so we need to make it optional. This commit adds a feature flag for the underline color attribute - it is enabled by default, but can be disabled by passing `--no-default-features` to cargo. We could specically check for Windows 7 and disable the feature flag automatically, but I think it's better for this check to be done by the crossterm crate, since it's the one that actually knows about the underlying terminal. To disable the feature flag in an application that supports Windows 7, add the following to your Cargo.toml: ```toml ratatui = { version = "0.24.0", default-features = false, features = ["crossterm"] } ``` Fixes https://github.com/ratatui-org/ratatui/issues/555
163 lines
3.6 KiB
TOML
163 lines
3.6 KiB
TOML
# configuration for https://github.com/sagiegurari/cargo-make
|
|
|
|
[config]
|
|
skip_core_tasks = true
|
|
|
|
[env]
|
|
# all features except the backend ones
|
|
ALL_FEATURES = "all-widgets,macros,serde"
|
|
|
|
# Windows does not support building termion, so this avoids the build failure by providing two
|
|
# sets of flags, one for Windows and one for other platforms.
|
|
# Windows: --features=all-widgets,macros,serde,crossterm,termwiz,underline-color
|
|
# Other: --features=all-widgets,macros,serde,crossterm,termion,termwiz,underline-color
|
|
ALL_FEATURES_FLAG = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = "--features=all-widgets,macros,serde,crossterm,termion,termwiz", mapping = { "windows" = "--features=all-widgets,macros,serde,crossterm,termwiz" } }
|
|
|
|
[tasks.default]
|
|
alias = "ci"
|
|
|
|
[tasks.ci]
|
|
description = "Run continuous integration tasks"
|
|
dependencies = ["lint-style", "clippy", "check", "test"]
|
|
|
|
[tasks.lint-style]
|
|
description = "Lint code style (formatting, typos, docs)"
|
|
dependencies = ["lint-format", "lint-typos", "lint-docs"]
|
|
|
|
[tasks.lint-format]
|
|
description = "Lint code formatting"
|
|
toolchain = "nightly"
|
|
command = "cargo"
|
|
args = ["fmt", "--all", "--check"]
|
|
|
|
[tasks.format]
|
|
description = "Fix code formatting"
|
|
toolchain = "nightly"
|
|
command = "cargo"
|
|
args = ["fmt", "--all"]
|
|
|
|
[tasks.lint-typos]
|
|
description = "Run typo checks"
|
|
install_crate = { crate_name = "typos-cli", binary = "typos", test_arg = "--version" }
|
|
command = "typos"
|
|
|
|
[tasks.lint-docs]
|
|
description = "Check documentation for errors and warnings"
|
|
toolchain = "nightly"
|
|
command = "cargo"
|
|
args = [
|
|
"rustdoc",
|
|
"--no-default-features",
|
|
"${ALL_FEATURES_FLAG}",
|
|
"--",
|
|
"-Zunstable-options",
|
|
"--check",
|
|
"-Dwarnings",
|
|
]
|
|
|
|
[tasks.check]
|
|
description = "Check code for errors and warnings"
|
|
command = "cargo"
|
|
args = [
|
|
"check",
|
|
"--all-targets",
|
|
"--no-default-features",
|
|
"${ALL_FEATURES_FLAG}",
|
|
]
|
|
|
|
[tasks.build]
|
|
description = "Compile the project"
|
|
command = "cargo"
|
|
args = [
|
|
"build",
|
|
"--all-targets",
|
|
"--no-default-features",
|
|
"${ALL_FEATURES_FLAG}",
|
|
]
|
|
|
|
[tasks.clippy]
|
|
description = "Run Clippy for linting"
|
|
command = "cargo"
|
|
args = [
|
|
"clippy",
|
|
"--all-targets",
|
|
"--tests",
|
|
"--benches",
|
|
"--no-default-features",
|
|
"${ALL_FEATURES_FLAG}",
|
|
"--",
|
|
"-D",
|
|
"warnings",
|
|
]
|
|
|
|
[tasks.test]
|
|
description = "Run tests"
|
|
dependencies = ["test-doc"]
|
|
command = "cargo"
|
|
args = [
|
|
"test",
|
|
"--all-targets",
|
|
"--no-default-features",
|
|
"${ALL_FEATURES_FLAG}",
|
|
]
|
|
|
|
[tasks.test-doc]
|
|
description = "Run documentation tests"
|
|
command = "cargo"
|
|
args = ["test", "--doc", "--no-default-features", "${ALL_FEATURES_FLAG}"]
|
|
|
|
[tasks.test-backend]
|
|
# takes a command line parameter to specify the backend to test (e.g. "crossterm")
|
|
description = "Run backend-specific tests"
|
|
command = "cargo"
|
|
args = [
|
|
"test",
|
|
"--all-targets",
|
|
"--no-default-features",
|
|
"--features",
|
|
"${ALL_FEATURES},${@}",
|
|
]
|
|
|
|
[tasks.coverage]
|
|
description = "Generate code coverage report"
|
|
command = "cargo"
|
|
args = [
|
|
"llvm-cov",
|
|
"--lcov",
|
|
"--output-path",
|
|
"target/lcov.info",
|
|
"--no-default-features",
|
|
"${ALL_FEATURES_FLAG}",
|
|
]
|
|
|
|
[tasks.run-example]
|
|
private = true
|
|
condition = { env_set = ["TUI_EXAMPLE_NAME"] }
|
|
command = "cargo"
|
|
args = [
|
|
"run",
|
|
"--release",
|
|
"--example",
|
|
"${TUI_EXAMPLE_NAME}",
|
|
"--features",
|
|
"all-widgets",
|
|
]
|
|
|
|
[tasks.build-examples]
|
|
description = "Compile project examples"
|
|
command = "cargo"
|
|
args = ["build", "--examples", "--release", "--features", "all-widgets"]
|
|
|
|
[tasks.run-examples]
|
|
description = "Run project examples"
|
|
dependencies = ["build-examples"]
|
|
script = '''
|
|
#!@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
|
|
end
|
|
'''
|