mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2025-12-29 23:55:52 +01:00
@@ -348,7 +348,7 @@ pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> O
|
||||
match fs::File::open(file_path) {
|
||||
Ok(f) => Some(f),
|
||||
Err(io_err) => {
|
||||
err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err))));
|
||||
err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err))));
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -414,7 +414,7 @@ impl TokenStorage for JsonTokenStorage {
|
||||
Err(err) =>
|
||||
match err.kind() {
|
||||
io::ErrorKind::NotFound => Ok(()),
|
||||
_ => Err(json::Error::IoError(err))
|
||||
_ => Err(json::Error::Io(err))
|
||||
},
|
||||
Ok(_) => Ok(()),
|
||||
}
|
||||
@@ -427,7 +427,7 @@ impl TokenStorage for JsonTokenStorage {
|
||||
Err(serde_err) => Err(serde_err),
|
||||
}
|
||||
},
|
||||
Err(io_err) => Err(json::Error::IoError(io_err))
|
||||
Err(io_err) => Err(json::Error::Io(io_err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -444,7 +444,7 @@ impl TokenStorage for JsonTokenStorage {
|
||||
Err(io_err) => {
|
||||
match io_err.kind() {
|
||||
io::ErrorKind::NotFound => Ok(None),
|
||||
_ => Err(json::Error::IoError(io_err))
|
||||
_ => Err(json::Error::Io(io_err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -477,7 +477,7 @@ pub enum ConfigurationError {
|
||||
DirectoryUnset,
|
||||
HomeExpansionFailed(String),
|
||||
Secret(ApplicationSecretError),
|
||||
IOError((String, io::Error)),
|
||||
Io((String, io::Error)),
|
||||
}
|
||||
|
||||
impl fmt::Display for ConfigurationError {
|
||||
@@ -491,7 +491,7 @@ impl fmt::Display for ConfigurationError {
|
||||
=> writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir),
|
||||
ConfigurationError::Secret(ref err)
|
||||
=> writeln!(f, "Secret -> {}", err),
|
||||
ConfigurationError::IOError((ref path, ref err))
|
||||
ConfigurationError::Io((ref path, ref err))
|
||||
=> writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err),
|
||||
}
|
||||
}
|
||||
@@ -499,14 +499,14 @@ impl fmt::Display for ConfigurationError {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum InputError {
|
||||
IOError((String, io::Error)),
|
||||
Io((String, io::Error)),
|
||||
Mime(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for InputError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
InputError::IOError((ref file_path, ref io_err))
|
||||
InputError::Io((ref file_path, ref io_err))
|
||||
=> writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err),
|
||||
InputError::Mime(ref mime)
|
||||
=> writeln!(f, "'{}' is not a known mime-type.", mime),
|
||||
@@ -664,7 +664,7 @@ pub fn application_secret_from_directory(dir: &str,
|
||||
let secret_path = Path::new(dir).join(secret_basename);
|
||||
let secret_str = || secret_path.as_path().to_str().unwrap().to_string();
|
||||
let secret_io_error = |io_err: io::Error| {
|
||||
Err(CLIError::Configuration(ConfigurationError::IOError(
|
||||
Err(CLIError::Configuration(ConfigurationError::Io(
|
||||
(secret_str(), io_err)
|
||||
)))
|
||||
};
|
||||
@@ -683,7 +683,7 @@ pub fn application_secret_from_directory(dir: &str,
|
||||
= json::from_str(json_console_secret).unwrap();
|
||||
match json::to_writer_pretty(&mut f, &console_secret) {
|
||||
Err(serde_err) => match serde_err {
|
||||
json::Error::IoError(err) => err,
|
||||
json::Error::Io(err) => err,
|
||||
_ => panic!("Unexpected serde error: {:#?}", serde_err)
|
||||
},
|
||||
Ok(_) => continue,
|
||||
@@ -696,7 +696,7 @@ pub fn application_secret_from_directory(dir: &str,
|
||||
},
|
||||
Ok(f) => {
|
||||
match json::de::from_reader::<_, ConsoleApplicationSecret>(f) {
|
||||
Err(json::Error::IoError(err)) =>
|
||||
Err(json::Error::Io(err)) =>
|
||||
return secret_io_error(err),
|
||||
Err(json_err) =>
|
||||
return Err(CLIError::Configuration(
|
||||
|
||||
@@ -27,7 +27,7 @@ use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_
|
||||
use std::default::Default;
|
||||
use std::str::FromStr;
|
||||
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate};
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType};
|
||||
use serde_json as json;
|
||||
use clap::ArgMatches;
|
||||
|
||||
@@ -675,7 +675,7 @@ impl<'n> Engine<'n> {
|
||||
JsonTokenStorage {
|
||||
program_name: "taskqueue1-beta2",
|
||||
db_dir: config_dir.clone(),
|
||||
}, None);
|
||||
}, Some(FlowType::InstalledInteractive));
|
||||
|
||||
let client =
|
||||
if opt.is_present("debug") {
|
||||
|
||||
Reference in New Issue
Block a user