mirror of https://github.com/MedzikUser/imgurs
rustfmt
This commit is contained in:
parent
a83788d0c6
commit
bd3ef20a7f
|
@ -6,7 +6,10 @@ pub mod upload_image;
|
||||||
|
|
||||||
use chrono::{prelude::DateTime, Utc};
|
use chrono::{prelude::DateTime, Utc};
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use std::{time::{Duration, UNIX_EPOCH}, process::exit};
|
use std::{
|
||||||
|
process::exit,
|
||||||
|
time::{Duration, UNIX_EPOCH},
|
||||||
|
};
|
||||||
|
|
||||||
use imgurs::api::ImageInfo;
|
use imgurs::api::ImageInfo;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use clap::{AppSettings, Parser, Subcommand, App, IntoApp};
|
use clap::{App, AppSettings, IntoApp, Parser, Subcommand};
|
||||||
use clap_complete::{generate, Shell, Generator};
|
use clap_complete::{generate, Generator, Shell};
|
||||||
use log::error;
|
use log::error;
|
||||||
|
|
||||||
use std::io::stdout;
|
use std::io::stdout;
|
||||||
|
@ -42,10 +42,11 @@ enum Commands {
|
||||||
#[clap(setting(AppSettings::ArgRequiredElseHelp), about = "Print image info")]
|
#[clap(setting(AppSettings::ArgRequiredElseHelp), about = "Print image info")]
|
||||||
Info { id: String },
|
Info { id: String },
|
||||||
|
|
||||||
#[clap(setting(AppSettings::ArgRequiredElseHelp), about = "Print shell completions (bash, zsh, fish, powershell)")]
|
#[clap(
|
||||||
Completions {
|
setting(AppSettings::ArgRequiredElseHelp),
|
||||||
shell: String,
|
about = "Print shell completions (bash, zsh, fish, powershell)"
|
||||||
},
|
)]
|
||||||
|
Completions { shell: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_completions<G: Generator>(gen: G, app: &mut App) {
|
fn print_completions<G: Generator>(gen: G, app: &mut App) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use imgurs::api::{configuration::ImgurHandle, upload_image::upload_image as uplo
|
||||||
|
|
||||||
use base64::encode as base64_encode;
|
use base64::encode as base64_encode;
|
||||||
use log::error;
|
use log::error;
|
||||||
use std::{fs::read as fs_read, process::exit, path::Path};
|
use std::{fs::read as fs_read, path::Path, process::exit};
|
||||||
|
|
||||||
pub async fn upload_image(client: ImgurHandle, path: &str) {
|
pub async fn upload_image(client: ImgurHandle, path: &str) {
|
||||||
let mut image: String = path.to_string();
|
let mut image: String = path.to_string();
|
||||||
|
@ -14,7 +14,7 @@ pub async fn upload_image(client: ImgurHandle, path: &str) {
|
||||||
image = base64_encode(bytes);
|
image = base64_encode(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
let i = upload_img(client, &image).await.unwrap_or_else(|e| {
|
let i = upload_img(client, &image).await.unwrap_or_else(|e| {
|
||||||
error!("{e}");
|
error!("{e}");
|
||||||
exit(1);
|
exit(1);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue