mirror of
https://github.com/storytold/cadcraft.git
synced 2026-12-01 18:25:32 -06:00
The CLI's argument parsing moved to clap on main, so the hand-rolled parser and its McpTarget change are rebuilt as two options, a usage error naming to the modules main split out (wblock, import, export, plot, saveas, compare, template, the LISP file builtins).
36 lines
1.2 KiB
Rust
36 lines
1.2 KiB
Rust
use crate::output::OutputError;
|
|
use crate::perf::PerfError;
|
|
use crate::roundtrip::RoundtripError;
|
|
use crate::run::RunError;
|
|
|
|
/// Why a subcommand failed: printed as `error: {e}`, exit 1.
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub(crate) enum CliError {
|
|
#[error(transparent)]
|
|
Engine(#[from] cadcraft_engine::EngineError),
|
|
#[error(transparent)]
|
|
Doc(#[from] cadcraft_engine::doc::DocError),
|
|
#[error(transparent)]
|
|
Format(#[from] cadcraft_io::IoError),
|
|
#[error(transparent)]
|
|
Io(#[from] std::io::Error),
|
|
#[error(transparent)]
|
|
Run(#[from] RunError),
|
|
#[error(transparent)]
|
|
Output(#[from] OutputError),
|
|
#[error(transparent)]
|
|
Perf(#[from] PerfError),
|
|
#[error(transparent)]
|
|
Roundtrip(#[from] RoundtripError),
|
|
/// The engine and io crates take file names as text.
|
|
#[error("{}: the file name is not valid Unicode", .0.display())]
|
|
NotUnicode(std::path::PathBuf),
|
|
#[error("cannot connect to {addr}: {source}")]
|
|
McpConnect { addr: String, source: std::io::Error },
|
|
/// An `--automation-*-root` that cannot be opened (missing, a file, a link that escapes).
|
|
#[error("{0}")]
|
|
AutomationRoots(String),
|
|
}
|
|
|
|
pub(crate) type Result<T = (), E = CliError> = std::result::Result<T, E>;
|