Adjust imports and add webp conversion.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
use crate::error;
|
||||
use std;
|
||||
use std::fs::File;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use ron::error::SpannedResult;
|
||||
use serde::{Deserialize, Deserializer, de::DeserializeOwned};
|
||||
use std::{
|
||||
fs::File,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
const SANE_DATE_FORMAT: &str = "%Y-%m-%d";
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use clap::Parser;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(author, version, about)]
|
||||
pub struct Args {
|
||||
|
||||
@@ -2,12 +2,13 @@ mod blog;
|
||||
mod cli;
|
||||
mod error;
|
||||
mod og;
|
||||
mod webp;
|
||||
|
||||
use crate::blog::Meta;
|
||||
use std::io::Read;
|
||||
|
||||
use clap::Parser;
|
||||
use markdown;
|
||||
use std::io::Read;
|
||||
|
||||
fn main() {
|
||||
let config = cli::Args::parse();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use serde::Deserialize;
|
||||
use std::fmt;
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub enum Gender {
|
||||
Male,
|
||||
|
||||
12
src/webp.rs
Normal file
12
src/webp.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use std::path::Path;
|
||||
|
||||
use image::ImageReader;
|
||||
|
||||
fn to_webp(path: &Path) -> Result<(), Box<dyn std::error::Error>> {
|
||||
ImageReader::open(path)?.decode()?.save(format!(
|
||||
"{}.webp",
|
||||
path.file_stem().unwrap().to_str().unwrap()
|
||||
))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user