diff options
author | Nick Gerace <nickagerace@gmail.com> | 2022-03-25 17:42:49 -0400 |
---|---|---|
committer | Nick Gerace <nickagerace@gmail.com> | 2022-03-25 17:44:40 -0400 |
commit | 52ccb1444e7aa675430ce4016685e0a60054a1d9 (patch) | |
tree | 0b20913dbc4017c3641f8d300761270739fe147e | |
parent | bcd37c3e8f3b13510a7947327e7723e56c1a1284 (diff) | |
download | gfold-52ccb1444e7aa675430ce4016685e0a60054a1d9.zip |
Revert "WIP 2"
This reverts commit 3cf1a18d5273c1ba84fb7f7aac276b19a06fcbd2.
-rw-r--r-- | Cargo.lock | 77 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/cli/mod.rs | 2 | ||||
-rw-r--r-- | src/config.rs | 2 | ||||
-rw-r--r-- | src/display/mod.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 25 | ||||
-rw-r--r-- | src/report/mod.rs | 2 | ||||
-rw-r--r-- | src/result.rs | 6 | ||||
-rw-r--r-- | src/run.rs | 2 |
9 files changed, 11 insertions, 108 deletions
@@ -3,30 +3,6 @@ version = 3 [[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "anyhow" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" -dependencies = [ - "backtrace", -] - -[[package]] name = "argh" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -73,21 +49,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "backtrace" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -214,7 +175,6 @@ dependencies = [ name = "gfold" version = "4.0.0-rc.1" dependencies = [ - "anyhow", "argh", "dirs", "env_logger", @@ -229,12 +189,6 @@ dependencies = [ ] [[package]] -name = "gimli" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" - -[[package]] name = "git2" version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -349,12 +303,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] -name = "memchr" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" - -[[package]] name = "memoffset" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -364,16 +312,6 @@ dependencies = [ ] [[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] name = "num_cpus" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -384,15 +322,6 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" -dependencies = [ - "memchr", -] - -[[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -467,12 +396,6 @@ dependencies = [ ] [[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] name = "ryu" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -14,7 +14,6 @@ version = "4.0.0-rc.1" rust-version = "1.56.1" [dependencies] -anyhow = { version = "1", features = ["backtrace"] } argh = "0" dirs = "4" git2 = { version = "0", default_features = false } diff --git a/src/cli/mod.rs b/src/cli/mod.rs index c2a44ab..6ae5114 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -3,7 +3,7 @@ use crate::config::{ColorMode, Config, DisplayMode}; use crate::error::Error; -use anyhow::Result; +use crate::result::Result; use crate::run; use argh::FromArgs; use std::env; diff --git a/src/config.rs b/src/config.rs index 953d1a2..f898d55 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,7 @@ //! This module contains the config specification and functionality for creating a config. use crate::error::Error; -use anyhow::Result; +use crate::result::Result; use serde::{Deserialize, Serialize}; use std::env; use std::path::PathBuf; diff --git a/src/display/mod.rs b/src/display/mod.rs index 895b326..5da34fe 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -4,7 +4,7 @@ use crate::config::{ColorMode, DisplayMode}; use crate::display::color::ColorHarness; use crate::error::Error; use crate::report::Reports; -use anyhow::Result; +use crate::result::Result; use log::warn; use std::path::Path; diff --git a/src/main.rs b/src/main.rs index 87b100a..4797f6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ //! track of multiple Git repositories. The source code uses private modules rather than leveraging //! a library via `lib.rs`. -use anyhow::Result; +use crate::result::Result; mod cli; mod config; @@ -15,9 +15,7 @@ mod status; /// Calls [`cli::parse_and_run()`] to generate a [`config::Config`] and eventually call [`run::run()`]; fn main() -> Result<()> { - cli::parse_and_run()?; - panic!( - Ok(()) + cli::parse_and_run() } #[cfg(test)] @@ -28,7 +26,6 @@ mod tests { use git2::Repository; use std::path::Path; use std::{env, fs, io}; - use git2::ErrorCode; #[test] fn integration() { @@ -88,27 +85,11 @@ mod tests { for name in ["one", "two", "three"] { let current = nested.join(name); create_dir_or_die(¤t); - let repository = Repository::init(¤t).expect("could not initialize repository"); + Repository::init(¤t).expect("could not initialize repository"); if name == "one" { create_file_or_die(¤t.join("newfile")); } - - if name == "two" { - if let Err(e) = repository.remote("origin", "https://google.com") { - if e.code() != ErrorCode::Exists { - panic!("{}", e); - } - } - } - - if name == "three" { - if let Err(e) = repository.remote("fork", "https://google.com") { - if e.code() != ErrorCode::Exists { - panic!("{}", e); - } - } - } } let mut config = Config::new().expect("could not create new config"); diff --git a/src/report/mod.rs b/src/report/mod.rs index 011e52d..aadab52 100644 --- a/src/report/mod.rs +++ b/src/report/mod.rs @@ -2,7 +2,7 @@ use crate::config::DisplayMode; use crate::error::Error; -use anyhow::Result; +use crate::result::Result; use crate::status::Status; use git2::{ErrorCode, Reference, Repository, StatusOptions}; use log::{debug, trace}; diff --git a/src/result.rs b/src/result.rs index 691e240..8f1d80a 100644 --- a/src/result.rs +++ b/src/result.rs @@ -1,6 +1,6 @@ -//! This module contains the [`anyhow::Result`] type. +//! This module contains the [`crate::result::Result`] type. use crate::error::Error; -/// Generic [`anyhow::Result`] wrapper around [`Error`]. -pub type Result<T> = anyhow::Result<T, Error>; +/// Generic [`std::result::Result`] wrapper around [`Error`]. +pub type Result<T> = std::result::Result<T, Error>; @@ -1,7 +1,7 @@ //! This module contains the execution logic for generating reports and displaying them to `stdout`. use crate::config::Config; -use anyhow::Result; +use crate::result::Result; use crate::{display, report}; /// This function is the primary entrypoint for the crate. It takes a given config and performs |