Cleanup pass: --help, in-app help, post-rebuild message, unmodified-temp cleanup
Four post-Iteration-4 polish items surfaced by manual testing.
1. `--help` / `-h` CLI flag prints a usage banner (options +
app-level commands + DSL grammar reference) and exits. Parse
errors also print the banner to stderr.
2. `help` app-level command notes the same list of supported
commands to the output panel -- a simple stand-in for the
richer H3 help system, kept in sync with what's actually
wired up.
3. The silent rebuild that runs when playground.db is missing
now surfaces a system message in the output panel ("[ok]
rebuild -- N tables, M rows reconstructed; ...") via a new
initial_events plumbing. The user no longer wonders whether
the .db was magically restored or whether anything happened
on launch.
4. Unmodified empty temp projects (kind=Temp, project.yaml has
tables: [] and relationships: []) are now auto-deleted when
the user switches away (load / new / save as) or quits. This
addresses the "launch app, load existing project, quit"
pattern that was leaving an empty temp directory behind
every time. Modified temps (with any user-created tables or
relationships) are never auto-deleted; corrupted projects
are also never auto-deleted (defensive default-to-false on
yaml read/parse errors).
Tests: 338 passing (272 lib + 9 + 5 + 6 + 20 + 9 + 17),
0 failing, 0 skipped. Clippy clean.
This commit is contained in:
+7
-1
@@ -1,6 +1,6 @@
|
||||
use std::process::ExitCode;
|
||||
|
||||
use rdbms_playground::cli::Args;
|
||||
use rdbms_playground::cli::{Args, HELP_TEXT};
|
||||
use rdbms_playground::{logging, runtime};
|
||||
|
||||
fn main() -> ExitCode {
|
||||
@@ -8,10 +8,16 @@ fn main() -> ExitCode {
|
||||
Ok(args) => args,
|
||||
Err(e) => {
|
||||
eprintln!("rdbms-playground: {e}");
|
||||
eprintln!("\n{HELP_TEXT}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
};
|
||||
|
||||
if args.help {
|
||||
print!("{HELP_TEXT}");
|
||||
return ExitCode::SUCCESS;
|
||||
}
|
||||
|
||||
if let Err(e) = logging::init(args.log_path.as_deref()) {
|
||||
eprintln!("rdbms-playground: failed to initialise logging: {e:#}");
|
||||
return ExitCode::FAILURE;
|
||||
|
||||
Reference in New Issue
Block a user