Files
cumulus/examples/canvas.rs
T
skkeyeandClaude Opus 5.5 abe3dc1d84 Read config.toml, keys.toml and themes, and open them with :config (stage 8b)
The config folder now sets everything: config.toml the settings (now
also `theme` and `editor`), keys.toml the keys, and themes/<name>.toml
the theme, laid over the built-in one, so a theme only needs what it
changes. Each file is applied again a second after it's saved; a
mistake only drops its own line, and the status bar says what's wrong,
naming the file.

:config lists the three files with their folder; Enter hands the
terminal to your editor (the editor setting, $VISUAL, $EDITOR, else
notepad or vi), writing the file first if it's missing, with every
option at its default behind a #, explained (keys.toml lists every
command by name). :theme switches themes until cumulus quits, like
:set.

The built-in theme gets the named styles the user picked, each also put
on by its tag: question (yellow, dashed), important (red, thick) and done
(gray, its title faded); and link styles blocks and supports, whose
label shows on a link without its own. Themes can also set [modes],
[node], [root], [branch] and [link].

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 23:55:11 -04:00

38 lines
1.6 KiB
Rust

//! The playground: cumulus itself, on copies of two sample documents (a
//! garden, and the kitchen its portal leads to), in a fresh temporary
//! folder. Trying things never changes the files in the repository, and
//! cumulus's own folders (where you left off, backups, locks) are in there
//! too, apart from your real ones.
//!
//! Run it with `cargo run --example canvas`. Everything works as in
//! `cumulus`, files included: the copies are saved as you go, and the folder
//! is printed when you quit, to look at them (or to change one while the
//! playground runs, and watch it reload).
use std::fs;
use std::io;
use cumulus::app::action::Message;
use cumulus::app::startup::Opening;
use cumulus::app::{App, load, run};
use cumulus::config::Config;
use cumulus::config::paths::Paths;
fn main() -> io::Result<()> {
let folder = std::env::temp_dir().join(format!("cumulus-playground-{}", std::process::id()));
fs::create_dir_all(&folder)?;
let (garden, kitchen) = (folder.join("garden.cum"), folder.join("kitchen.cum"));
fs::write(&garden, include_str!("garden.cum"))?;
fs::write(&kitchen, include_str!("kitchen.cum"))?;
let opening = Opening {
first: load(&garden).map_err(io::Error::other)?,
others: vec![load(&kitchen).map_err(io::Error::other)?],
message: Some(Message::info("the playground: copies of the samples, in a temporary folder")),
};
let paths = Paths::inside(&folder.join("cumulus"));
let config = Config::load(&paths);
run(App::new(paths, config, opening))?;
println!("The playground's files are in {}", folder.display());
Ok(())
}