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:
parent
b6b49dc052
commit
71d47f338b
@ -10,7 +10,7 @@ authors = ["Paul-Christian Volkmer"]
|
|||||||
members = ["ui"]
|
members = ["ui"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
openssl = { version = "0.10"}
|
openssl = { version = "0.10" }
|
||||||
clap = { version = "4.5", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
|
clap = { version = "4.5", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
|
||||||
console = "0.15"
|
console = "0.15"
|
||||||
itertools = "0.14"
|
itertools = "0.14"
|
||||||
|
@ -47,7 +47,7 @@ fn asn1time(time: &SystemTime) -> Asn1Time {
|
|||||||
.expect("time not went backwards")
|
.expect("time not went backwards")
|
||||||
.as_secs() as i64,
|
.as_secs() as i64,
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
|
@ -97,7 +97,7 @@ fn main() -> Result<(), ()> {
|
|||||||
Ok(pem) => {
|
Ok(pem) => {
|
||||||
println!("{pem}");
|
println!("{pem}");
|
||||||
eprintln!("{}", style("success").green());
|
eprintln!("{}", style("success").green());
|
||||||
},
|
}
|
||||||
Err(err) => eprintln!("{}", style(err).red()),
|
Err(err) => eprintln!("{}", style(err).red()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,17 +278,17 @@ impl Ui {
|
|||||||
File::Invalid(_) => text_input(placeholder, &text),
|
File::Invalid(_) => text_input(placeholder, &text),
|
||||||
_ => text_input(placeholder, &text),
|
_ => text_input(placeholder, &text),
|
||||||
}
|
}
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.style(move |theme, status| text_input::Style {
|
.style(move |theme, status| text_input::Style {
|
||||||
background: Background::Color(Color::WHITE),
|
background: Background::Color(Color::WHITE),
|
||||||
placeholder: color!(0x888888),
|
placeholder: color!(0x888888),
|
||||||
value: match file {
|
value: match file {
|
||||||
File::Certificates(_, _) | File::PrivateKey(_, _) => Color::BLACK,
|
File::Certificates(_, _) | File::PrivateKey(_, _) => Color::BLACK,
|
||||||
File::Invalid(_) => color!(0xaa0000),
|
File::Invalid(_) => color!(0xaa0000),
|
||||||
File::None => color!(0x888888),
|
File::None => color!(0x888888),
|
||||||
},
|
},
|
||||||
..text_input::default(theme, status)
|
..text_input::default(theme, status)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let cert_file_input = {
|
let cert_file_input = {
|
||||||
@ -306,8 +306,8 @@ impl Ui {
|
|||||||
.on_press(Message::PickCertFile)
|
.on_press(Message::PickCertFile)
|
||||||
.style(button::secondary)
|
.style(button::secondary)
|
||||||
]
|
]
|
||||||
.spacing(2)
|
.spacing(2)
|
||||||
.align_y(alignment::Vertical::Center)
|
.align_y(alignment::Vertical::Center)
|
||||||
};
|
};
|
||||||
|
|
||||||
let ca_file_input = {
|
let ca_file_input = {
|
||||||
@ -329,8 +329,8 @@ impl Ui {
|
|||||||
button("..").style(button::secondary)
|
button("..").style(button::secondary)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
.spacing(2)
|
.spacing(2)
|
||||||
.align_y(alignment::Vertical::Center)
|
.align_y(alignment::Vertical::Center)
|
||||||
};
|
};
|
||||||
|
|
||||||
let key_file_input = {
|
let key_file_input = {
|
||||||
@ -352,8 +352,8 @@ impl Ui {
|
|||||||
button("..").style(button::secondary)
|
button("..").style(button::secondary)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
.spacing(2)
|
.spacing(2)
|
||||||
.align_y(alignment::Vertical::Center)
|
.align_y(alignment::Vertical::Center)
|
||||||
};
|
};
|
||||||
|
|
||||||
let export_button = if !(self.chain_indicator_state == IndicatorState::Success
|
let export_button = if !(self.chain_indicator_state == IndicatorState::Success
|
||||||
@ -406,7 +406,7 @@ impl Ui {
|
|||||||
horizontal_space(),
|
horizontal_space(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
.spacing(2);
|
.spacing(2);
|
||||||
|
|
||||||
let output = {
|
let output = {
|
||||||
Scrollable::new(
|
Scrollable::new(
|
||||||
@ -418,7 +418,7 @@ impl Ui {
|
|||||||
})
|
})
|
||||||
.font(Font::MONOSPACE),
|
.font(Font::MONOSPACE),
|
||||||
)
|
)
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
};
|
};
|
||||||
|
|
||||||
let certs = {
|
let certs = {
|
||||||
@ -527,14 +527,14 @@ impl Ui {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
.spacing(2),
|
.spacing(2),
|
||||||
)
|
)
|
||||||
.padding(8)
|
.padding(8)
|
||||||
.style(|_| container::Style {
|
.style(|_| container::Style {
|
||||||
background: Some(Background::Color(Color::WHITE)),
|
background: Some(Background::Color(Color::WHITE)),
|
||||||
..container::Style::default()
|
..container::Style::default()
|
||||||
})
|
})
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -682,10 +682,10 @@ impl Ui {
|
|||||||
.center_x(160)
|
.center_x(160)
|
||||||
.center_y(40),
|
.center_y(40),
|
||||||
]
|
]
|
||||||
.spacing(4),
|
.spacing(4),
|
||||||
)
|
)
|
||||||
.center_x(160)
|
.center_x(160)
|
||||||
.center_y(80)
|
.center_y(80)
|
||||||
};
|
};
|
||||||
|
|
||||||
column![
|
column![
|
||||||
@ -709,9 +709,9 @@ impl Ui {
|
|||||||
text(format!("Version {}", env!("CARGO_PKG_VERSION"))).style(|_| text::Style { color: Some(color!(0x888888)) }),
|
text(format!("Version {}", env!("CARGO_PKG_VERSION"))).style(|_| text::Style { color: Some(color!(0x888888)) }),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
.padding(4)
|
.padding(4)
|
||||||
.spacing(2)
|
.spacing(2)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_output(&self) -> Result<String, String> {
|
fn print_output(&self) -> Result<String, String> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user