aboutsummaryrefslogtreecommitdiff
path: root/src/command
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-01-05 00:38:55 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2025-01-05 00:38:55 +0100
commitd7fef30ac3f539975ef9edbba8e0af4a4e9ff3de (patch)
tree1e71dd131261a8f7a13d86d4dddd7d421e6a09f4 /src/command
parentd26464d12e41e8d53fca8d0e5f9cc6ac03e48f9a (diff)
Commit batch of lints to allow autofix
Diffstat (limited to 'src/command')
-rw-r--r--src/command/add.rs13
-rw-r--r--src/command/add_remote.rs15
-rw-r--r--src/command/generate.rs42
-rw-r--r--src/command/help.rs8
-rw-r--r--src/command/mod.rs30
-rw-r--r--src/command/publish.rs18
-rw-r--r--src/command/publish_archive.rs23
-rw-r--r--src/command/remove_remote.rs4
-rw-r--r--src/command/status/blog_status.rs8
-rw-r--r--src/command/status/configuration_status.rs19
-rw-r--r--src/command/status/mod.rs13
-rw-r--r--src/command/sync_down.rs16
-rw-r--r--src/command/sync_up.rs15
-rw-r--r--src/command/update.rs50
-rw-r--r--src/command/version.rs8
15 files changed, 162 insertions, 120 deletions
diff --git a/src/command/add.rs b/src/command/add.rs
index 02da0fb..d38d077 100644
--- a/src/command/add.rs
+++ b/src/command/add.rs
@@ -1,12 +1,7 @@
+use super::{generate::Generate, sync_down::SyncDown, sync_up::SyncUp, update::Update};
+use crate::configuration::Configuration;
use std::fs::{create_dir_all, remove_dir_all, rename};
use std::io::Result;
-use super::{
- generate::Generate,
- sync_down::SyncDown,
- sync_up::SyncUp,
- update::Update
-};
-use crate::configuration::Configuration;
pub struct Add;
@@ -21,7 +16,7 @@ impl super::Command for Add {
vec![Box::new(SyncDown::new())]
}
- fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
+ fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &str) -> Result<()> {
create_dir_all(&configuration.posts_directory)?;
for i in (0..configuration.max_posts - 1).rev() {
let source = configuration.posts_directory.join(i.to_string());
@@ -41,7 +36,7 @@ impl super::Command for Add {
vec![
Box::new(Update::new()),
Box::new(Generate::new()),
- Box::new(SyncUp::new())
+ Box::new(SyncUp::new()),
]
}
diff --git a/src/command/add_remote.rs b/src/command/add_remote.rs
index e9157f3..e5ca591 100644
--- a/src/command/add_remote.rs
+++ b/src/command/add_remote.rs
@@ -1,6 +1,6 @@
-use std::io::{Error, ErrorKind::Other, Result};
use crate::configuration::Configuration;
use crate::remote::add;
+use std::io::{Error, ErrorKind::Other, Result};
pub struct AddRemote;
@@ -15,10 +15,19 @@ impl super::Command for AddRemote {
vec![]
}
- fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
+ fn execute(
+ &self,
+ input: Option<&String>,
+ configuration: &Configuration,
+ _: &str,
+ ) -> Result<()> {
let input = input
.ok_or_else(|| Error::new(Other, "You must provide a location for the remote."))?;
- add(&configuration.config_directory, &configuration.remote_config, input)
+ add(
+ &configuration.config_directory,
+ &configuration.remote_config,
+ input,
+ )
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
diff --git a/src/command/generate.rs b/src/command/generate.rs
index cc9e401..a79058d 100644
--- a/src/command/generate.rs
+++ b/src/command/generate.rs
@@ -1,13 +1,13 @@
-use std::fs::{create_dir_all, read_dir, remove_dir_all, File};
-use std::io::{Read, Result};
-use std::path::PathBuf;
+use crate::archiver::archive;
use crate::configuration::Configuration;
use crate::constants::METADATA_FILENAME;
-use crate::gemini_parser::parse;
use crate::generator::generate;
-use crate::archiver::archive;
use crate::metadata::Metadata;
use crate::post::Post;
+use gema_texto::{gemini_parser::parse, html_renderer::render_html};
+use std::fs::{create_dir_all, read_dir, remove_dir_all, File};
+use std::io::{Read, Result};
+use std::path::Path;
pub struct Generate;
@@ -16,22 +16,22 @@ impl Generate {
Generate
}
- fn read_posts(&self, posts_directory: &PathBuf, max_posts: u8) -> Vec<Post> {
+ fn read_posts(&self, posts_directory: &Path, max_posts: u8) -> Vec<Post> {
let mut posts = Vec::new();
for i in 0..max_posts {
- let post_directory = posts_directory.join(i.to_string());
- match self.read_post(&post_directory, i) {
+ let post_path = posts_directory.join(i.to_string());
+ match self.read_post(&post_path, i) {
Some(post) => posts.push(post),
- None => continue
+ None => continue,
}
}
posts
}
- fn find_blog_content(&self, post_directory: &PathBuf) -> Option<String> {
- let entries = read_dir(&post_directory).ok()?;
+ fn find_blog_content(post_path: &Path) -> Option<String> {
+ let entries = read_dir(post_path).ok()?;
for entry in entries.filter_map(Result::ok) {
let entry_path = entry.path();
match entry_path.extension() {
@@ -42,24 +42,24 @@ impl Generate {
file.read_to_string(&mut contents).ok()?;
return Some(contents);
}
- },
- None => continue
+ }
+ None => continue,
}
}
None
}
- fn read_post(&self, post_directory: &PathBuf, index: u8) -> Option<Post> {
+ fn read_post(&self, post_directory: &Path, index: u8) -> Option<Post> {
let metadata_path = post_directory.join(METADATA_FILENAME);
let metadata = Metadata::read_or_create(&metadata_path);
- let raw = self.find_blog_content(&post_directory)?;
- let html = parse(&raw);
+ let raw = Generate::find_blog_content(post_directory)?;
+ let html = render_html(&parse(&raw));
Some(Post {
metadata,
index,
html,
- raw
+ raw,
})
}
}
@@ -69,7 +69,7 @@ impl super::Command for Generate {
vec![]
}
- fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
+ fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &str) -> Result<()> {
let _ = remove_dir_all(&configuration.blog_output_directory);
create_dir_all(&configuration.blog_output_directory)?;
@@ -78,7 +78,7 @@ impl super::Command for Generate {
&configuration.static_directory,
&configuration.templates_directory,
&configuration.blog_output_directory,
- &posts
+ &posts,
)?;
let _ = remove_dir_all(&configuration.archive_output_directory);
@@ -86,9 +86,9 @@ impl super::Command for Generate {
archive(
&configuration.archive_directory,
&configuration.templates_directory,
- &configuration.archive_output_directory
+ &configuration.archive_output_directory,
)?;
- return Ok(())
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
diff --git a/src/command/help.rs b/src/command/help.rs
index 8d2a2c0..b682fc0 100644
--- a/src/command/help.rs
+++ b/src/command/help.rs
@@ -1,6 +1,6 @@
-use std::io::Result;
use super::available_commands;
use crate::configuration::Configuration;
+use std::io::Result;
pub struct Help;
@@ -15,15 +15,15 @@ impl super::Command for Help {
vec![]
}
- fn execute(&self, _: Option<&String>, _: &Configuration, _: &String) -> Result<()> {
+ fn execute(&self, _: Option<&String>, _: &Configuration, _: &str) -> Result<()> {
let commands = available_commands();
println!("Usage:");
- println!("");
+ println!();
for command in commands {
print!("blog {} ", command.command());
println!("{}", command.help());
}
- return Ok(())
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
diff --git a/src/command/mod.rs b/src/command/mod.rs
index 0c96e6f..2807193 100644
--- a/src/command/mod.rs
+++ b/src/command/mod.rs
@@ -1,37 +1,41 @@
pub mod add;
+pub mod add_remote;
pub mod generate;
-pub mod update;
+pub mod help;
pub mod publish;
pub mod publish_archive;
-pub mod add_remote;
pub mod remove_remote;
-pub mod sync_up;
-pub mod sync_down;
pub mod status;
+pub mod sync_down;
+pub mod sync_up;
+pub mod update;
pub mod version;
-pub mod help;
-
use std::io::Result;
use add::Add;
+use add_remote::AddRemote;
use generate::Generate;
-use update::Update;
+use help::Help;
use publish::Publish;
use publish_archive::PublishArchive;
-use add_remote::AddRemote;
use remove_remote::RemoveRemote;
-use sync_up::SyncUp;
+use status::Status;
use sync_down::SyncDown;
+use sync_up::SyncUp;
+use update::Update;
use version::Version;
-use status::Status;
-use help::Help;
use crate::configuration::Configuration;
pub trait Command {
fn before_dependencies(&self) -> Vec<Box<dyn Command>>;
- fn execute(&self, input: Option<&String>, configuration: &Configuration, command: &String) -> Result<()>;
+ fn execute(
+ &self,
+ input: Option<&String>,
+ configuration: &Configuration,
+ command: &str,
+ ) -> Result<()>;
fn after_dependencies(&self) -> Vec<Box<dyn Command>>;
fn command(&self) -> &'static str;
fn help(&self) -> &'static str;
@@ -50,6 +54,6 @@ pub fn available_commands() -> Vec<Box<dyn Command>> {
Box::new(SyncDown::new()),
Box::new(Status::new()),
Box::new(Version::new()),
- Box::new(Help::new())
+ Box::new(Help::new()),
]
}
diff --git a/src/command/publish.rs b/src/command/publish.rs
index 34ca0d2..388792f 100644
--- a/src/command/publish.rs
+++ b/src/command/publish.rs
@@ -1,5 +1,5 @@
-use std::io::{Error, ErrorKind::Other, Result};
use crate::configuration::Configuration;
+use std::io::{Error, ErrorKind::Other, Result};
use std::process::{Command, Stdio};
const COMMAND: &str = "rsync";
@@ -17,8 +17,12 @@ impl super::Command for Publish {
vec![]
}
- fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
-
+ fn execute(
+ &self,
+ input: Option<&String>,
+ configuration: &Configuration,
+ _: &str,
+ ) -> Result<()> {
let input = input
.ok_or_else(|| Error::new(Other, "You must provide a location to publish the blog"))?;
@@ -29,16 +33,18 @@ impl super::Command for Publish {
.status()
.map_err(|_| Error::new(Other, "Publishing requires rsync"))?;
-
Command::new(COMMAND)
.arg("-r")
- .arg(format!("{}/", &configuration.blog_output_directory.display()))
+ .arg(format!(
+ "{}/",
+ &configuration.blog_output_directory.display()
+ ))
.arg(input.as_str())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.map_err(|_| Error::new(Other, "Rsync failed to publish."))?;
- return Ok(())
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
diff --git a/src/command/publish_archive.rs b/src/command/publish_archive.rs
index c727c16..96dda86 100644
--- a/src/command/publish_archive.rs
+++ b/src/command/publish_archive.rs
@@ -1,5 +1,5 @@
-use std::io::{Error, ErrorKind::Other, Result};
use crate::configuration::Configuration;
+use std::io::{Error, ErrorKind::Other, Result};
use std::process::{Command, Stdio};
const COMMAND: &str = "rsync";
@@ -17,10 +17,15 @@ impl super::Command for PublishArchive {
vec![]
}
- fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
-
- let input = input
- .ok_or_else(|| Error::new(Other, "You must provide a location to publish the archive"))?;
+ fn execute(
+ &self,
+ input: Option<&String>,
+ configuration: &Configuration,
+ _: &str,
+ ) -> Result<()> {
+ let input = input.ok_or_else(|| {
+ Error::new(Other, "You must provide a location to publish the archive")
+ })?;
Command::new(COMMAND)
.arg("--version")
@@ -29,16 +34,18 @@ impl super::Command for PublishArchive {
.status()
.map_err(|_| Error::new(Other, "Publishing requires rsync"))?;
-
Command::new(COMMAND)
.arg("-r")
- .arg(format!("{}/", &configuration.archive_output_directory.display()))
+ .arg(format!(
+ "{}/",
+ &configuration.archive_output_directory.display()
+ ))
.arg(input.as_str())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.map_err(|_| Error::new(Other, "Rsync failed to publish."))?;
- return Ok(())
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
diff --git a/src/command/remove_remote.rs b/src/command/remove_remote.rs
index 7590487..ee1dfde 100644
--- a/src/command/remove_remote.rs
+++ b/src/command/remove_remote.rs
@@ -1,6 +1,6 @@
-use std::io::Result;
use crate::configuration::Configuration;
use crate::remote::remove;
+use std::io::Result;
pub struct RemoveRemote;
@@ -15,7 +15,7 @@ impl super::Command for RemoveRemote {
vec![]
}
- fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
+ fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &str) -> Result<()> {
remove(&configuration.remote_config)
}
diff --git a/src/command/status/blog_status.rs b/src/command/status/blog_status.rs
index df5256e..48f608a 100644
--- a/src/command/status/blog_status.rs
+++ b/src/command/status/blog_status.rs
@@ -1,6 +1,6 @@
+use crate::configuration::Configuration;
use std::fs::read_dir;
use std::path::PathBuf;
-use crate::configuration::Configuration;
pub fn status(configuration: &Configuration) -> String {
let mut status_message = String::new();
@@ -9,16 +9,16 @@ pub fn status(configuration: &Configuration) -> String {
// Main Configuration Locations
let blog_count = count_entries(&configuration.posts_directory);
- status_message.push_str(&format!("Number of posts in blog: {}\n", blog_count));
+ status_message.push_str(&format!("Number of posts in blog: {blog_count}\n"));
let archive_count = count_entries(&configuration.archive_directory);
- status_message.push_str(&format!("Number of posts in archive: {}\n", archive_count));
+ status_message.push_str(&format!("Number of posts in archive: {archive_count}\n"));
status_message
}
fn count_entries(path: &PathBuf) -> String {
match read_dir(path) {
Ok(entries) => entries.filter_map(Result::ok).count().to_string(),
- Err(_) => "0".to_string()
+ Err(_) => "0".to_string(),
}
}
diff --git a/src/command/status/configuration_status.rs b/src/command/status/configuration_status.rs
index 6d4e56a..96555c6 100644
--- a/src/command/status/configuration_status.rs
+++ b/src/command/status/configuration_status.rs
@@ -1,6 +1,6 @@
+use crate::configuration::Configuration;
use std::fs;
use std::path::PathBuf;
-use crate::configuration::Configuration;
pub fn status(configuration: &Configuration) -> String {
let mut status_message = String::new();
@@ -9,12 +9,21 @@ pub fn status(configuration: &Configuration) -> String {
status_message.push_str("\n## Directories\n");
// Main Configuration Locations
- status_message.push_str(&get_directory_stats("Configuration", &configuration.config_directory));
+ status_message.push_str(&get_directory_stats(
+ "Configuration",
+ &configuration.config_directory,
+ ));
status_message.push_str(&get_directory_stats("Data", &configuration.data_directory));
- status_message.push_str(&get_directory_stats("Output", &configuration.output_directory));
+ status_message.push_str(&get_directory_stats(
+ "Output",
+ &configuration.output_directory,
+ ));
status_message.push_str("\n## Blog Settings\n");
- status_message.push_str(&format!("Number of posts to keep: {}\n", configuration.max_posts));
+ status_message.push_str(&format!(
+ "Number of posts to keep: {}\n",
+ configuration.max_posts
+ ));
status_message
}
@@ -24,7 +33,7 @@ fn get_directory_stats(label: &str, directory: &PathBuf) -> String {
status_message.push_str(&format!("{}: {}. ", label, directory.display()));
if directory.exists() {
status_message.push_str("Exists ");
- if fs::read_dir(&directory).is_ok() {
+ if fs::read_dir(directory).is_ok() {
status_message.push_str("and is readable.\n");
} else {
status_message.push_str("but is not readable.\n");
diff --git a/src/command/status/mod.rs b/src/command/status/mod.rs
index e620f78..b92ef5f 100644
--- a/src/command/status/mod.rs
+++ b/src/command/status/mod.rs
@@ -1,8 +1,8 @@
-mod configuration_status;
mod blog_status;
+mod configuration_status;
-use std::io::Result;
use crate::configuration::Configuration;
+use std::io::Result;
pub struct Status;
@@ -17,12 +17,12 @@ impl super::Command for Status {
vec![]
}
- fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
+ fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &str) -> Result<()> {
let status_providers = available_status_providers();
for status_provider in status_providers {
println!("{}\n----\n", status_provider(configuration));
}
- return Ok(())
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
@@ -39,8 +39,5 @@ impl super::Command for Status {
}
fn available_status_providers() -> Vec<fn(&Configuration) -> String> {
- vec![
- configuration_status::status,
- blog_status::status,
- ]
+ vec![configuration_status::status, blog_status::status]
}
diff --git a/src/command/sync_down.rs b/src/command/sync_down.rs
index eb8e57a..f9122d4 100644
--- a/src/command/sync_down.rs
+++ b/src/command/sync_down.rs
@@ -1,6 +1,6 @@
-use std::io::{Result};
use crate::configuration::Configuration;
use crate::remote::sync_down;
+use std::io::Result;
pub struct SyncDown;
@@ -15,16 +15,21 @@ impl super::Command for SyncDown {
vec![]
}
- fn execute(&self, _: Option<&String>, configuration: &Configuration, command: &String) -> Result<()> {
+ fn execute(
+ &self,
+ _: Option<&String>,
+ configuration: &Configuration,
+ command: &str,
+ ) -> Result<()> {
match sync_down(&configuration.data_directory, &configuration.remote_config) {
- Ok(_) => {}
+ Ok(()) => {}
Err(e) => {
if command == self.command() {
- return Err(e)
+ return Err(e);
}
}
}
- return Ok(())
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
@@ -39,4 +44,3 @@ impl super::Command for SyncDown {
"\t\t\t\tPulls from the git remote if configured"
}
}
-
diff --git a/src/command/sync_up.rs b/src/command/sync_up.rs
index c44e0b0..b609c34 100644
--- a/src/command/sync_up.rs
+++ b/src/command/sync_up.rs
@@ -1,6 +1,6 @@
-use std::io::Result;
use crate::configuration::Configuration;
use crate::remote::sync_up;
+use std::io::Result;
pub struct SyncUp;
@@ -15,16 +15,21 @@ impl super::Command for SyncUp {
vec![]
}
- fn execute(&self, _: Option<&String>, configuration: &Configuration, command: &String) -> Result<()> {
+ fn execute(
+ &self,
+ _: Option<&String>,
+ configuration: &Configuration,
+ command: &str,
+ ) -> Result<()> {
match sync_up(&configuration.data_directory, &configuration.remote_config) {
- Ok(_) => {}
+ Ok(()) => {}
Err(e) => {
if command == self.command() {
- return Err(e)
+ return Err(e);
}
}
}
- return Ok(())
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
diff --git a/src/command/update.rs b/src/command/update.rs
index 8a3d6de..54005f8 100644
--- a/src/command/update.rs
+++ b/src/command/update.rs
@@ -1,11 +1,11 @@
-use std::fs::{copy, create_dir_all, read_dir, remove_dir_all, write};
-use std::io::{Result, Error, ErrorKind};
-use std::path::PathBuf;
-use super::{sync_down::SyncDown, generate::Generate, sync_up::SyncUp};
+use super::{generate::Generate, sync_down::SyncDown, sync_up::SyncUp};
use crate::configuration::Configuration;
use crate::constants::METADATA_FILENAME;
use crate::metadata::Metadata;
use serde_json;
+use std::fs::{copy, create_dir_all, read_dir, remove_dir_all, write};
+use std::io::{Error, ErrorKind, Result};
+use std::path::{Path, PathBuf};
pub struct Update;
@@ -14,8 +14,9 @@ impl Update {
Update
}
- fn copy_post(&self, source: &PathBuf, target: &PathBuf) -> Result<()> {
- let post_name = source.file_name()
+ fn copy_post(source: &PathBuf, target: &Path) -> Result<()> {
+ let post_name = source
+ .file_name()
.ok_or_else(|| Error::new(ErrorKind::InvalidInput, "Could not get post filename."))?;
let target_post = target.join(post_name);
@@ -23,13 +24,13 @@ impl Update {
Ok(())
}
- fn write_metadata(&self, metadata: &Metadata, metadata_location: &PathBuf) -> Result<()> {
+ fn write_metadata(metadata: &Metadata, metadata_location: &PathBuf) -> Result<()> {
let serialized_metadata = serde_json::to_string(&metadata)?;
write(metadata_location, serialized_metadata)?;
Ok(())
}
- fn archive(&self, source: &PathBuf, target: &PathBuf) -> Result<()> {
+ fn archive(source: &PathBuf, target: &Path) -> Result<()> {
let entries = read_dir(source)?;
for entry in entries {
let entry = entry?;
@@ -39,7 +40,7 @@ impl Update {
let entry_target = target.join(entry_name);
if entry_type.is_dir() {
- self.archive(&entry_source, &entry_target)?;
+ Update::archive(&entry_source, &entry_target)?;
} else {
copy(&entry_source, &entry_target)?;
}
@@ -54,12 +55,21 @@ impl super::Command for Update {
vec![Box::new(SyncDown::new())]
}
- fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
- let input = input
- .ok_or_else(|| Error::new(ErrorKind::InvalidInput, "You must provide a path to a post"))?;
+ fn execute(
+ &self,
+ input: Option<&String>,
+ configuration: &Configuration,
+ _: &str,
+ ) -> Result<()> {
+ let input = input.ok_or_else(|| {
+ Error::new(ErrorKind::InvalidInput, "You must provide a path to a post")
+ })?;
let post_location = PathBuf::from(input);
if !post_location.exists() {
- return Err(Error::new(ErrorKind::NotFound, "The path provided does not exist"));
+ return Err(Error::new(
+ ErrorKind::NotFound,
+ "The path provided does not exist",
+ ));
}
// Step 1. Write into the ephemeral posts
@@ -73,8 +83,8 @@ impl super::Command for Update {
let _ = remove_dir_all(&first_post_path);
create_dir_all(&first_post_path)?;
- self.copy_post(&post_location, &first_post_path)?;
- self.write_metadata(&metadata, &metadata_file_path)?;
+ Update::copy_post(&post_location, &first_post_path)?;
+ Update::write_metadata(&metadata, &metadata_file_path)?;
// Step 2. Write into the archive
@@ -84,15 +94,12 @@ impl super::Command for Update {
let _ = remove_dir_all(&post_archive_path);
create_dir_all(&post_archive_path)?;
- self.archive(&first_post_path, &post_archive_path)?;
- return Ok(())
+ Update::archive(&first_post_path, &post_archive_path)?;
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
- vec![
- Box::new(Generate::new()),
- Box::new(SyncUp::new())
- ]
+ vec![Box::new(Generate::new()), Box::new(SyncUp::new())]
}
fn command(&self) -> &'static str {
@@ -103,4 +110,3 @@ impl super::Command for Update {
"<path_to_post>\t\tUpdates latest blog post"
}
}
-
diff --git a/src/command/version.rs b/src/command/version.rs
index e566c5a..94eb92e 100644
--- a/src/command/version.rs
+++ b/src/command/version.rs
@@ -1,5 +1,5 @@
-use std::io::Result;
use crate::configuration::Configuration;
+use std::io::Result;
pub struct Version;
@@ -14,10 +14,10 @@ impl super::Command for Version {
vec![]
}
- fn execute(&self, _: Option<&String>, _: &Configuration, _: &String) -> Result<()> {
+ fn execute(&self, _: Option<&String>, _: &Configuration, _: &str) -> Result<()> {
let version = env!("CARGO_PKG_VERSION");
- println!("{}", version);
- return Ok(())
+ println!("{version}");
+ Ok(())
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {