Skip to content

Commit

Permalink
chore: v1 smaller binary
Browse files Browse the repository at this point in the history
  • Loading branch information
NuttyShrimp committed Nov 18, 2024
1 parent 43cba60 commit 371bea4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 208 deletions.
196 changes: 1 addition & 195 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[package]
name = "mjml-converter"
version = "0.1.0"
version = "1.0.0"
edition = "2021"

[dependencies]
anyhow = "1"
clap = { version = "4.5.21", features = ["derive"] }
mrml = "3"
serde = { version = "1.0", features = ["derive"] }
18 changes: 8 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
use clap::Parser;
use mrml::prelude::{parser::ParserOptions, render::RenderOptions};
use std::env::args;

#[derive(Parser, Debug)]
#[command(about, long_about = None)]
struct Args {
#[arg(short, long)]
template: String,
}
use mrml::prelude::{parser::ParserOptions, render::RenderOptions};

fn main() {
let args = Args::parse();
if args().len() != 2 {
eprintln!("This program takes 2 argument");
return;
}
let template = args().skip(1).next().unwrap();

let parser_options = ParserOptions::default();
let render_options = RenderOptions::default();
match mrml::parse_with_options(&args.template, &parser_options) {
match mrml::parse_with_options(&template, &parser_options) {
Ok(mjml) => match mjml.render(&render_options) {
Ok(html) => print!("{}", html),
Err(err) => eprintln!("Failed to render to html: {err:?}"),
Expand Down

0 comments on commit 371bea4

Please sign in to comment.