Dev (#1)
Sync README to GitHub / sync (push) Successful in 12s
CI / check (push) Successful in 8m31s
Deploy docs / deploy (push) Successful in 6m44s
Nightly / nightly (push) Successful in 10m33s

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2026-08-07 15:48:11 -04:00
parent 228a0da47f
commit abc0bdf621
79 changed files with 31370 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
// SPDX-License-Identifier: Prosperity-3.0.0
// Copyright Scientific Computing Studio
// Source: https://git.scient.ing/education/coursebank
//! Command handlers, grouped by workflow stage.
//!
//! [`run`] is the single dispatch point: it matches the parsed [`Command`] and
//! calls the matching handler. The handlers themselves live in submodules that
//! follow the workflow described in the crate documentation:
//!
//! - [`project`] — set up and check a course: `init`, `schema`, `validate`,
//! `lint`, `catalog`.
//! - [`banks`] — manage items and build assessments: `bank`, `assessment`,
//! `assemble`, `usage`.
//! - [`export`] — turn an assessment into deliverables: `export`, `template`.
//! - [`analysis`] — the responses-to-report pipeline: `ingest`, `analyze`,
//! `calibrate`, `report`, `data`.
//!
//! Every handler returns [`Outcome`] so the dispatcher can distinguish "finished
//! cleanly" from "finished, but found problems worth a non-zero exit code".
pub(crate) mod analysis;
pub(crate) mod banks;
pub(crate) mod export;
pub(crate) mod project;
use coursebank::error::Result;
use crate::cli::{Cli, Command};
/// What a command concluded.
pub(crate) enum Outcome {
/// Nothing to report.
Ok,
/// Problems were found, which is not the same as the command failing.
Findings,
}
/// Dispatches a command.
///
/// # Arguments
///
/// * `cli` - the parsed arguments.
///
/// # Returns
///
/// Whether findings were reported.
///
/// # Errors
///
/// Propagates any failure from the underlying operation.
pub(crate) fn run(cli: &Cli) -> Result<Outcome> {
match &cli.command {
Command::Init(args) => project::init(cli, args),
Command::Schema => project::schema(cli),
Command::Validate => project::validate(cli),
Command::Lint(args) => project::lint(cli, args),
Command::Catalog(args) => project::catalog(cli, args),
Command::Bank(sub) => banks::bank(cli, sub),
Command::Assessment(sub) => banks::assessment(cli, sub),
Command::Assemble(args) => banks::assemble(cli, args),
Command::Usage(sub) => banks::usage(cli, sub),
Command::Export(sub) => export::export(cli, sub),
Command::Template(sub) => export::template(cli, sub),
Command::Ingest(sub) => analysis::ingest(cli, sub),
Command::Analyze(sub) => analysis::analyze(cli, sub),
Command::Calibrate(args) => analysis::calibrate(cli, args),
Command::Report(sub) => analysis::report(cli, sub),
Command::Data => analysis::data(cli),
}
}