diff options
| author | Mel <einebeere@gmail.com> | 2021-09-21 01:04:49 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-09-21 01:05:03 +0200 |
| commit | 9e019b462ff05315641c95442faf7f8fc80f76b1 (patch) | |
| tree | 5813c85887544d865542fb122882a1fb9d2be718 /src/actions/mod.rs | |
| parent | c25d22681f9bc6ddba512895182af0ce0252731b (diff) | |
| download | ka-9e019b462ff05315641c95442faf7f8fc80f76b1.tar.zst ka-9e019b462ff05315641c95442faf7f8fc80f76b1.zip | |
Slightly more consistent error handling
Diffstat (limited to 'src/actions/mod.rs')
| -rw-r--r-- | src/actions/mod.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/actions/mod.rs b/src/actions/mod.rs index 588ce8f..86af955 100644 --- a/src/actions/mod.rs +++ b/src/actions/mod.rs @@ -4,6 +4,7 @@ mod update; use std::path::{Path, PathBuf}; +use anyhow::Result; pub use create::create; pub use shift::shift; pub use update::update; @@ -19,12 +20,8 @@ impl ActionOptions { } } - pub fn from_pwd() -> Result<Self, ()> { - let current_path = std::env::current_dir(); - if let Ok(repository_path) = current_path { - Ok(ActionOptions { repository_path }) - } else { - Err(()) - } + pub fn from_pwd() -> Result<Self> { + let repository_path = std::env::current_dir()?; + Ok(ActionOptions { repository_path }) } } |
