1
0
mirror of https://github.com/pcvolkmer/cert-tools.git synced 2025-04-19 09:06:49 +00:00

chore: code cleanup

This commit is contained in:
Paul-Christian Volkmer 2025-01-27 21:38:16 +01:00
parent b6b49dc052
commit 71d47f338b
4 changed files with 35 additions and 35 deletions

View File

@ -10,7 +10,7 @@ authors = ["Paul-Christian Volkmer"]
members = ["ui"]
[dependencies]
openssl = { version = "0.10"}
openssl = { version = "0.10" }
clap = { version = "4.5", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
console = "0.15"
itertools = "0.14"

View File

@ -47,7 +47,7 @@ fn asn1time(time: &SystemTime) -> Asn1Time {
.expect("time not went backwards")
.as_secs() as i64,
)
.unwrap()
.unwrap()
}
#[derive(PartialEq)]

View File

@ -97,7 +97,7 @@ fn main() -> Result<(), ()> {
Ok(pem) => {
println!("{pem}");
eprintln!("{}", style("success").green());
},
}
Err(err) => eprintln!("{}", style(err).red()),
}
}

View File

@ -278,17 +278,17 @@ impl Ui {
File::Invalid(_) => text_input(placeholder, &text),
_ => text_input(placeholder, &text),
}
.width(Length::Fill)
.style(move |theme, status| text_input::Style {
background: Background::Color(Color::WHITE),
placeholder: color!(0x888888),
value: match file {
File::Certificates(_, _) | File::PrivateKey(_, _) => Color::BLACK,
File::Invalid(_) => color!(0xaa0000),
File::None => color!(0x888888),
},
..text_input::default(theme, status)
})
.width(Length::Fill)
.style(move |theme, status| text_input::Style {
background: Background::Color(Color::WHITE),
placeholder: color!(0x888888),
value: match file {
File::Certificates(_, _) | File::PrivateKey(_, _) => Color::BLACK,
File::Invalid(_) => color!(0xaa0000),
File::None => color!(0x888888),
},
..text_input::default(theme, status)
})
}
let cert_file_input = {
@ -306,8 +306,8 @@ impl Ui {
.on_press(Message::PickCertFile)
.style(button::secondary)
]
.spacing(2)
.align_y(alignment::Vertical::Center)
.spacing(2)
.align_y(alignment::Vertical::Center)
};
let ca_file_input = {
@ -329,8 +329,8 @@ impl Ui {
button("..").style(button::secondary)
}
]
.spacing(2)
.align_y(alignment::Vertical::Center)
.spacing(2)
.align_y(alignment::Vertical::Center)
};
let key_file_input = {
@ -352,8 +352,8 @@ impl Ui {
button("..").style(button::secondary)
}
]
.spacing(2)
.align_y(alignment::Vertical::Center)
.spacing(2)
.align_y(alignment::Vertical::Center)
};
let export_button = if !(self.chain_indicator_state == IndicatorState::Success
@ -406,7 +406,7 @@ impl Ui {
horizontal_space(),
]
}
.spacing(2);
.spacing(2);
let output = {
Scrollable::new(
@ -418,7 +418,7 @@ impl Ui {
})
.font(Font::MONOSPACE),
)
.height(Length::Fill)
.height(Length::Fill)
};
let certs = {
@ -527,14 +527,14 @@ impl Ui {
]
},
]
.spacing(2),
.spacing(2),
)
.padding(8)
.style(|_| container::Style {
background: Some(Background::Color(Color::WHITE)),
..container::Style::default()
})
.width(Length::Fill),
.padding(8)
.style(|_| container::Style {
background: Some(Background::Color(Color::WHITE)),
..container::Style::default()
})
.width(Length::Fill),
)
}
};
@ -682,10 +682,10 @@ impl Ui {
.center_x(160)
.center_y(40),
]
.spacing(4),
.spacing(4),
)
.center_x(160)
.center_y(80)
.center_x(160)
.center_y(80)
};
column![
@ -709,9 +709,9 @@ impl Ui {
text(format!("Version {}", env!("CARGO_PKG_VERSION"))).style(|_| text::Style { color: Some(color!(0x888888)) }),
]
]
.padding(4)
.spacing(2)
.into()
.padding(4)
.spacing(2)
.into()
}
fn print_output(&self) -> Result<String, String> {