Skip to content

Commit

Permalink
Remove failure from grit binary, too
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jun 15, 2020
1 parent 70939c8 commit 417c34b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 138 deletions.
121 changes: 1 addition & 120 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ test = false
doctest = false

[dependencies]
failure = "0.1.1"
failure-tools = "4.0.2"
clap = "2.31.2"
git-core = { version = "0.1.0", path = "git-core" }
anyhow = "1.0.31"

[profile.release]
panic = 'unwind'
Expand Down
18 changes: 5 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
extern crate failure;
extern crate failure_tools;
#[macro_use]
extern crate clap;
extern crate git_core as git;

use failure::{Error, ResultExt};
use failure_tools::ok_or_exit;
use anyhow::{Context, Result};

mod app {
use clap::{App, AppSettings, SubCommand};
Expand All @@ -20,18 +16,14 @@ mod app {
}
}

fn run() -> Result<(), Error> {
fn main() -> Result<()> {
let app = app::new();
let matches = app.get_matches();
match matches.subcommand() {
("init", Some(_args)) => {
git::init::repository().with_context(|_| "Repository initialization failed")
git::init::repository().with_context(|| "Repository initialization failed")
}
_ => unreachable!(),
}
.map_err(Into::into)
}

fn main() {
ok_or_exit(run())
}?;
Ok(())
}
7 changes: 4 additions & 3 deletions tests/snapshots/cli/init-fail
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
error: Repository initialization failed
Caused by:
1: Refusing to initialize the existing '.git' directory
Error: Repository initialization failed

Caused by:
Refusing to initialize the existing '.git' directory

0 comments on commit 417c34b

Please sign in to comment.