Files
turso/cli/build.rs
Glauber Costa fbc3d0dbc3 Add built-in manual pages for Turso
In the hopes of doing a good job at teaching people what Turso can do,
I am adding built-in manual pages. When the CLI starts, it picks a
feature at random, and tells the user that the feature exists:

```
Turso v0.2.0-pre.8
Enter ".help" for usage hints.
Did you know that Turso supports Change Data Capture? Type .manual cdc to learn more.
This software is ALPHA, only use for development, testing, and experimentation.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
```

There is a lot we can do to make this feature world class:
- we can automatically compile examples during compile time like
  rust-doc, to make sure examples used in the manuals always work
- we can implement scrolling and navigation
- we can document a lot more features

But for now, this is a start!
2025-09-24 11:29:24 -03:00

28 lines
833 B
Rust

//! Build.rs script to generate a binary syntax set for syntect
//! based on the SQL.sublime-syntax file.
use std::env;
use std::path::Path;
use syntect::dumps::dump_to_uncompressed_file;
use syntect::parsing::SyntaxDefinition;
use syntect::parsing::SyntaxSet;
fn main() {
println!("cargo::rerun-if-changed=SQL.sublime-syntax");
println!("cargo::rerun-if-changed=build.rs");
println!("cargo::rerun-if-changed=manuals");
let out_dir = env::var_os("OUT_DIR").unwrap();
let syntax =
SyntaxDefinition::load_from_str(include_str!("./SQL.sublime-syntax"), false, None).unwrap();
let mut ps = SyntaxSet::new().into_builder();
ps.add(syntax);
let ps = ps.build();
dump_to_uncompressed_file(
&ps,
Path::new(&out_dir).join("SQL_syntax_set_dump.packdump"),
)
.unwrap();
}