Return anyhow::Result from main function

This should improve the way errors are displayed for end users with a
list of causes.
This commit is contained in:
fabianlindfors 2022-01-02 23:34:06 +01:00
parent 78c0093412
commit ef82acd480

View File

@ -58,13 +58,9 @@ struct FindMigrationsOptions {
dirs: Vec<String>,
}
fn main() {
fn main() -> anyhow::Result<()> {
let opts: Opts = Opts::parse();
let result = run(opts);
if let Err(e) = result {
println!("Error: {}", e);
}
run(opts)
}
fn run(opts: Opts) -> anyhow::Result<()> {