This commit is contained in:
MedzikUserBot 2022-01-25 16:14:23 +00:00
parent a83788d0c6
commit bd3ef20a7f
3 changed files with 13 additions and 9 deletions

View File

@ -6,7 +6,10 @@ pub mod upload_image;
use chrono::{prelude::DateTime, Utc};
use log::{error, info};
use std::{time::{Duration, UNIX_EPOCH}, process::exit};
use std::{
process::exit,
time::{Duration, UNIX_EPOCH},
};
use imgurs::api::ImageInfo;

View File

@ -1,5 +1,5 @@
use clap::{AppSettings, Parser, Subcommand, App, IntoApp};
use clap_complete::{generate, Shell, Generator};
use clap::{App, AppSettings, IntoApp, Parser, Subcommand};
use clap_complete::{generate, Generator, Shell};
use log::error;
use std::io::stdout;
@ -42,10 +42,11 @@ enum Commands {
#[clap(setting(AppSettings::ArgRequiredElseHelp), about = "Print image info")]
Info { id: String },
#[clap(setting(AppSettings::ArgRequiredElseHelp), about = "Print shell completions (bash, zsh, fish, powershell)")]
Completions {
shell: String,
},
#[clap(
setting(AppSettings::ArgRequiredElseHelp),
about = "Print shell completions (bash, zsh, fish, powershell)"
)]
Completions { shell: String },
}
fn print_completions<G: Generator>(gen: G, app: &mut App) {

View File

@ -3,7 +3,7 @@ use imgurs::api::{configuration::ImgurHandle, upload_image::upload_image as uplo
use base64::encode as base64_encode;
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) {
let mut image: String = path.to_string();
@ -14,7 +14,7 @@ pub async fn upload_image(client: ImgurHandle, path: &str) {
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}");
exit(1);
});