Skip to content

Commit

Permalink
refactor(app): move miette hook setup
Browse files Browse the repository at this point in the history
  • Loading branch information
norskeld committed Apr 7, 2024
1 parent b7f51d7 commit b9f7433
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ impl App {

/// Runs the app and prints any errors.
pub async fn run(&mut self) {
miette::set_hook(Box::new(|_| {
Box::new(
miette::MietteHandlerOpts::new()
.terminal_links(false)
.context_lines(3)
.tab_width(4)
.build(),
)
}))
.expect("Failed to set up the miette hook");

let scaffold_res = self.scaffold().await;

if scaffold_res.is_err() {
Expand All @@ -114,17 +125,6 @@ impl App {

/// Kicks of the scaffolding process.
pub async fn scaffold(&mut self) -> miette::Result<()> {
// Slightly tweak miette.
miette::set_hook(Box::new(|_| {
Box::new(
miette::MietteHandlerOpts::new()
.terminal_links(false)
.context_lines(3)
.tab_width(4)
.build(),
)
}))?;

// Build override options.
let overrides = ConfigOptionsOverrides { delete: self.cli.delete };

Expand Down

0 comments on commit b9f7433

Please sign in to comment.