Reformat code.
This commit is contained in:
+40
-35
@@ -1,51 +1,56 @@
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
use crate::password::Password;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
#[derive(thiserror::Error, Debug, PartialEq)]
|
||||
pub enum LKErr<'a> {
|
||||
#[error("Error: {0}")]
|
||||
Error(&'a str),
|
||||
#[error("Failed to read the line: {0}")]
|
||||
ReadError(String),
|
||||
#[error("Failed to parse: {0}")]
|
||||
ParseError(peg::error::ParseError<peg::str::LineCol>),
|
||||
#[error("Error: {0}")]
|
||||
Error(&'a str),
|
||||
#[error("Failed to read the line: {0}")]
|
||||
ReadError(String),
|
||||
#[error("Failed to parse: {0}")]
|
||||
ParseError(peg::error::ParseError<peg::str::LineCol>),
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum Command<'a> {
|
||||
Add(Rc<RefCell<Password>>),
|
||||
Ls,
|
||||
Mv(String, String),
|
||||
Error(LKErr<'a>),
|
||||
Help,
|
||||
Quit
|
||||
Add(Rc<RefCell<Password>>),
|
||||
Ls,
|
||||
Mv(String, String),
|
||||
Error(LKErr<'a>),
|
||||
Help,
|
||||
Quit,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum Mode {
|
||||
Regular,
|
||||
RegularUpcase,
|
||||
NoSpace,
|
||||
NoSpaceUpcase,
|
||||
Hex,
|
||||
HexUpcase,
|
||||
Base64,
|
||||
Base64Upcase,
|
||||
Decimal,
|
||||
Regular,
|
||||
RegularUpcase,
|
||||
NoSpace,
|
||||
NoSpaceUpcase,
|
||||
Hex,
|
||||
HexUpcase,
|
||||
Base64,
|
||||
Base64Upcase,
|
||||
Decimal,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Mode {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", match self {
|
||||
Mode::Regular => "R",
|
||||
Mode::RegularUpcase => "UR",
|
||||
Mode::NoSpace => "N",
|
||||
Mode::NoSpaceUpcase => "UN",
|
||||
Mode::Hex => "H",
|
||||
Mode::HexUpcase => "UH",
|
||||
Mode::Base64 => "B",
|
||||
Mode::Base64Upcase => "UB",
|
||||
Mode::Decimal => "D",
|
||||
}.to_string())
|
||||
}
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self {
|
||||
Mode::Regular => "R",
|
||||
Mode::RegularUpcase => "UR",
|
||||
Mode::NoSpace => "N",
|
||||
Mode::NoSpaceUpcase => "UN",
|
||||
Mode::Hex => "H",
|
||||
Mode::HexUpcase => "UH",
|
||||
Mode::Base64 => "B",
|
||||
Mode::Base64Upcase => "UB",
|
||||
Mode::Decimal => "D",
|
||||
}
|
||||
.to_string()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user