diff --git a/CLAUDE.md b/CLAUDE.md index b68a294..204f623 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,14 +32,15 @@ python3 -m http.server -d dist 8080 ``` Native CLI flags (`src/cli.rs`, applied in `FractalApp::apply_cli`): `--kind`, -`--power`, `--julia re,im`, `--share `, +`--power`, `--julia re,im`, `--phoenix-p re,im`, `--lambda-l re,im`, +`--palette`, `--share `, `--view re,im,half_height[,iterations]`, `--de`, `--buddhabrot`, -`--buddha-palette`, `--export` (+ `--export-path out.png`). `--headless` -(`src/headless.rs`) skips the window entirely: it builds the same view from -the other flags, creates its own offscreen wgpu device, and renders straight -to a PNG (`--width`/`--height`, default 1920×1080) — implies `--export`'s -save behavior without needing a GPU-backed window/event loop. Not yet -supported with `--buddhabrot`. Run `mandelbrot --help` for the full list. +`--buddha-palette`. `--headless` (`src/headless.rs`) skips the window +entirely: it builds the same view from the other flags, creates its own +offscreen wgpu device, and renders straight to a PNG (`--width`/`--height`, +default 1920×1080, `--export-path out.png`) without needing a GPU-backed +window/event loop. Not yet supported with `--buddhabrot`. Run +`mandelbrot --help` for the full list. There's no GPU in most sandboxes: `cargo check`/`cargo test --test shader_valid` are the fast, headless way to validate a change. `cargo test` also runs but diff --git a/src/app.rs b/src/app.rs index 6048d42..550b794 100644 --- a/src/app.rs +++ b/src/app.rs @@ -327,7 +327,7 @@ pub struct FractalApp { export_requested: bool, /// Progress/handle for an in-flight PNG export, if any. export: Option>>, - /// Output path for `--export` (native CLI only); falls back to a + /// Output path for `--export-path` (native CLI only); falls back to a /// timestamped name when unset. export_path: Option, /// Short status line (saved path, "link copied", errors). @@ -500,6 +500,24 @@ impl FractalApp { self.view = Self::default_view_for(FractalMode::Julia, self.kind); } } + if let Some(pp) = &cli.phoenix_p { + let p: Vec<&str> = pp.split(',').collect(); + if let (Some(Ok(re)), Some(Ok(im))) = ( + p.first().map(|s| s.trim().parse::()), + p.get(1).map(|s| s.trim().parse::()), + ) { + self.phoenix_p = (re, im); + } + } + if let Some(ll) = &cli.lambda_l { + let p: Vec<&str> = ll.split(',').collect(); + if let (Some(Ok(re)), Some(Ok(im))) = ( + p.first().map(|s| s.trim().parse::()), + p.get(1).map(|s| s.trim().parse::()), + ) { + self.lambda_l = (re, im); + } + } if let Some(frag) = cli.share && let Some(state) = ShareState::decode(&frag) { @@ -517,10 +535,10 @@ impl FractalApp { if let Some(p) = cli.buddha_palette { self.buddha_palette = p.min(BUDDHA_PALETTE_NAMES.len() as u32 - 1); } - self.export_path = cli.export_path; - if cli.export { - self.export_requested = true; + if let Some(p) = cli.palette { + self.palette = p.min(PALETTE_NAMES.len() as u32 - 1); } + self.export_path = cli.export_path; } /// Apply a view spec "re,im,half_height[,iterations]" (re/im are decimal, diff --git a/src/cli.rs b/src/cli.rs index e2563ef..df5eb2c 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -25,6 +25,18 @@ pub struct Cli { #[arg(long, value_name = "RE,IM")] pub julia: Option, + /// Coloring palette index. + #[arg(long, value_name = "INDEX")] + pub palette: Option, + + /// Phoenix constant p for the Phoenix kind (z -> z^2 + c + p*z_prev). + #[arg(long, value_name = "RE,IM")] + pub phoenix_p: Option, + + /// Lambda constant λ for the Lambda kind (z -> λ*z*(1 - z)). + #[arg(long, value_name = "RE,IM")] + pub lambda_l: Option, + /// Restore a view from a share-link fragment (the part after '#'). #[arg(long, value_name = "FRAGMENT")] pub share: Option, @@ -45,11 +57,7 @@ pub struct Cli { #[arg(long, value_name = "INDEX")] pub buddha_palette: Option, - /// Render a PNG export on startup. - #[arg(long)] - pub export: bool, - - /// Output path for --export/--headless (default: fractal-.png). + /// Output path for --headless (default: fractal-.png). #[arg(long, value_name = "PATH")] pub export_path: Option,