Skip to content

Commit

Permalink
feat(cli): added base codecs
Browse files Browse the repository at this point in the history
  • Loading branch information
SalOne22 committed Feb 26, 2024
1 parent b8be3ff commit 60d9aa5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::PathBuf;
use clap::{arg, command, value_parser, Command};
use indoc::indoc;

use crate::{preprocessors::Preprocessors, utils::threads};
use crate::{codecs::Codecs, preprocessors::Preprocessors, utils::threads};

pub fn cli() -> Command {
command!()
Expand Down Expand Up @@ -53,6 +53,7 @@ pub fn cli() -> Command {
.value_parser(value_parser!(u8).range(1..=threads::num_threads() as i64)),
)
.preprocessors()
.codecs()
}

#[cfg(test)]
Expand Down
5 changes: 5 additions & 0 deletions src/codecs/jpeg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use clap::Command;

pub fn jpeg() -> Command {
Command::new("jpeg").about("Encode images into JPEG format")
}
15 changes: 15 additions & 0 deletions src/codecs/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use clap::Command;

use self::jpeg::jpeg;

mod jpeg;

impl Codecs for Command {
fn codecs(self) -> Self {
self.subcommands([jpeg()])
}
}

pub trait Codecs {
fn codecs(self) -> Self;
}
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use cli::cli;

mod cli;
mod codecs;
mod preprocessors;
mod utils;

Expand Down

0 comments on commit 60d9aa5

Please sign in to comment.