aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/util')
-rw-r--r--crates/shirabe/src/util/auth_helper.rs6
-rw-r--r--crates/shirabe/src/util/forgejo.rs2
-rw-r--r--crates/shirabe/src/util/git.rs2
-rw-r--r--crates/shirabe/src/util/gitlab.rs2
-rw-r--r--crates/shirabe/src/util/perforce.rs12
-rw-r--r--crates/shirabe/src/util/svn.rs2
6 files changed, 15 insertions, 11 deletions
diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs
index 0a2dbf86..8a621eb1 100644
--- a/crates/shirabe/src/util/auth_helper.rs
+++ b/crates/shirabe/src/util/auth_helper.rs
@@ -168,7 +168,7 @@ impl AuthHelper {
"After authorizing your token, confirm that you would like to retry the request"
.to_string(),
PhpMixed::Null,
- );
+ )?;
return Ok(PromptAuthResult {
retry: true,
@@ -420,7 +420,9 @@ impl AuthHelper {
true,
io_interface::NORMAL,
);
- let username = self.io.ask(" Username: ".to_string(), PhpMixed::Null);
+ let username = self
+ .io
+ .ask(" Username: ".to_string(), PhpMixed::Null)?;
let password = self.io.ask_and_hide_answer(" Password: ".to_string());
self.io.borrow_mut().set_authentication(
origin.to_string(),
diff --git a/crates/shirabe/src/util/forgejo.rs b/crates/shirabe/src/util/forgejo.rs
index 41d0dd3d..34d44b7b 100644
--- a/crates/shirabe/src/util/forgejo.rs
+++ b/crates/shirabe/src/util/forgejo.rs
@@ -80,7 +80,7 @@ impl Forgejo {
let username = self
.io
- .ask("Username: ".to_string(), shirabe_php_shim::PhpMixed::Null)
+ .ask("Username: ".to_string(), shirabe_php_shim::PhpMixed::Null)?
.as_string()
.map(|s| s.trim().to_string())
.unwrap_or_default();
diff --git a/crates/shirabe/src/util/git.rs b/crates/shirabe/src/util/git.rs
index 3e650fd1..1c3474ea 100644
--- a/crates/shirabe/src/util/git.rs
+++ b/crates/shirabe/src/util/git.rs
@@ -703,7 +703,7 @@ impl Git {
default_username
.map(PhpMixed::String)
.unwrap_or(PhpMixed::Null),
- )
+ )?
.as_string()
.map(|s| s.to_string()),
);
diff --git a/crates/shirabe/src/util/gitlab.rs b/crates/shirabe/src/util/gitlab.rs
index 485d4126..2b23cdbf 100644
--- a/crates/shirabe/src/util/gitlab.rs
+++ b/crates/shirabe/src/util/gitlab.rs
@@ -419,7 +419,7 @@ impl GitLab {
}
fn create_token(&mut self, scheme: &str, origin_url: &str) -> anyhow::Result<PhpMixed> {
- let username = match self.io.ask("Username: ".to_string(), PhpMixed::Null) {
+ let username = match self.io.ask("Username: ".to_string(), PhpMixed::Null)? {
PhpMixed::String(s) => s,
_ => String::new(),
};
diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs
index 9cd804a4..e2591301 100644
--- a/crates/shirabe/src/util/perforce.rs
+++ b/crates/shirabe/src/util/perforce.rs
@@ -253,18 +253,18 @@ impl Perforce {
self.p4_user = user;
}
- pub fn query_p4_user(&mut self) {
+ pub fn query_p4_user(&mut self) -> anyhow::Result<()> {
let _ = self.get_user();
if strlen(&self.p4_user.clone().unwrap_or_default()) > 0 {
- return;
+ return Ok(());
}
self.p4_user = self.get_p4_variable("P4USER");
if strlen(&self.p4_user.clone().unwrap_or_default()) > 0 {
- return;
+ return Ok(());
}
self.p4_user = self
.io
- .ask("Enter P4 User:".to_string(), PhpMixed::Null)
+ .ask("Enter P4 User:".to_string(), PhpMixed::Null)?
.as_string()
.map(|s| s.to_string());
let command = if self.windows_flag {
@@ -280,6 +280,8 @@ impl Perforce {
)
};
self.execute_command(PhpMixed::String(command));
+
+ Ok(())
}
pub(crate) fn get_p4_variable(&mut self, name: &str) -> Option<String> {
@@ -554,7 +556,7 @@ impl Perforce {
}
pub fn p4_login(&mut self) -> anyhow::Result<()> {
- self.query_p4_user();
+ self.query_p4_user()?;
if !self.is_logged_in()? {
let password = self.query_p4_password();
if self.windows_flag {
diff --git a/crates/shirabe/src/util/svn.rs b/crates/shirabe/src/util/svn.rs
index 67501e5a..50315316 100644
--- a/crates/shirabe/src/util/svn.rs
+++ b/crates/shirabe/src/util/svn.rs
@@ -234,7 +234,7 @@ impl Svn {
self.credentials = Some(SvnCredentials {
username: self
.io
- .ask("Username: ".to_string(), PhpMixed::String("".to_string()))
+ .ask("Username: ".to_string(), PhpMixed::String("".to_string()))?
.as_string()
.unwrap_or("")
.to_string(),