mirror of
https://github.com/helix-editor/helix.git
synced 2024-12-18 22:11:55 +04:00
82dd963693
* Add: xtask to check themes for validation warnings * Update: tidied up runtime paths * Update: test build workflow * Update: address clippy lints * Revert: only trigger workflow on push to master branch * Add: Theme::from_keys factory method to construct theme from Toml keys * Update: returning validation failures in Loader.load method * Update: commented out invalid keys from affected themes * Update: correct invalid keys so that valid styles still applied * Update: include default and base16_default themes in check * Update: renamed validation_failures to load_errors * Update: introduce load_with_warnings helper function and centralise logging of theme warnings * Update: use consistent naming throughout
58 lines
1.4 KiB
Rust
58 lines
1.4 KiB
Rust
mod docgen;
|
|
mod helpers;
|
|
mod path;
|
|
mod querycheck;
|
|
mod theme_check;
|
|
|
|
use std::{env, error::Error};
|
|
|
|
type DynError = Box<dyn Error>;
|
|
|
|
pub mod tasks {
|
|
use crate::docgen::{lang_features, typable_commands, write};
|
|
use crate::docgen::{LANG_SUPPORT_MD_OUTPUT, TYPABLE_COMMANDS_MD_OUTPUT};
|
|
use crate::querycheck::query_check;
|
|
use crate::theme_check::theme_check;
|
|
use crate::DynError;
|
|
|
|
pub fn docgen() -> Result<(), DynError> {
|
|
write(TYPABLE_COMMANDS_MD_OUTPUT, &typable_commands()?);
|
|
write(LANG_SUPPORT_MD_OUTPUT, &lang_features()?);
|
|
Ok(())
|
|
}
|
|
|
|
pub fn querycheck() -> Result<(), DynError> {
|
|
query_check()
|
|
}
|
|
|
|
pub fn themecheck() -> Result<(), DynError> {
|
|
theme_check()
|
|
}
|
|
|
|
pub fn print_help() {
|
|
println!(
|
|
"
|
|
Usage: Run with `cargo xtask <task>`, eg. `cargo xtask docgen`.
|
|
|
|
Tasks:
|
|
docgen: Generate files to be included in the mdbook output.
|
|
query-check: Check that tree-sitter queries are valid.
|
|
"
|
|
);
|
|
}
|
|
}
|
|
|
|
fn main() -> Result<(), DynError> {
|
|
let task = env::args().nth(1);
|
|
match task {
|
|
None => tasks::print_help(),
|
|
Some(t) => match t.as_str() {
|
|
"docgen" => tasks::docgen()?,
|
|
"query-check" => tasks::querycheck()?,
|
|
"theme-check" => tasks::themecheck()?,
|
|
invalid => return Err(format!("Invalid task name: {}", invalid).into()),
|
|
},
|
|
};
|
|
Ok(())
|
|
}
|