trying to fix thingy

cli-redesign
Avril 4 years ago
parent 218d9747c3
commit 11ad053ff1
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,6 +1,6 @@
[package]
name = "lolistealer"
version = "0.1.0"
version = "1.0.0"
authors = ["Avril <flanchan@cumallover.me>"]
edition = "2018"

@ -17,7 +17,7 @@ lazy_static! {
/// Print usage then exit with code `1`
pub fn usage() -> !
{
println!("Usage: {} [--rating <rating>] [<outputs...>]", &PROGRAM_NAME[..]);
println!("Usage: {} [--rating <rating>] [--number <number>] <output dir>]", &PROGRAM_NAME[..]);
println!("Usage: {} --help", &PROGRAM_NAME[..]);
std::process::exit(1)
@ -34,9 +34,7 @@ fn try_dir(path: impl AsRef<Path>) -> Result<config::OutputType, Error>
let path = path.as_ref();
if path.is_dir() {
Ok(config::OutputType::Directory(path.to_owned()))
} else if !path.exists() {
Ok(config::OutputType::File(path.to_owned()))
} else {
} else {
Err(Error::FileExists(path.to_owned()))
}
}
@ -95,7 +93,7 @@ where I: IntoIterator<Item=String>
#[derive(Debug)]
pub enum Error {
UnknownRating(String),
FileExists(PathBuf),
BadPath(PathBuf),
NoOutput,
Internal(Box<dyn error::Error>),
@ -110,7 +108,7 @@ impl fmt::Display for Error
match self {
Error::NoOutput => write!(f, "need at least one output, try `{} --help`", &PROGRAM_NAME[..]),
Error::UnknownRating(rating) => write!(f, "{} is not a valid rating", rating),
Error::FileExists(path) => write!(f, "file already exists: {:?}", path),
Error::BadPath(path) => write!(f, "directory does not exist, or is file: {:?}", path),
Error::Internal(bx) => write!(f, "internal error: {}", bx),
_ => write!(f, "unknown error"),
}

@ -35,7 +35,8 @@ pub enum OutputType
pub struct Config
{
pub rating: Rating,
pub output: Vec<OutputType>
pub number: u64,
pub output: OutputType,
}
impl Default for Rating

@ -91,7 +91,7 @@ fn find_back(haystack: &[u8], needle: &[u8]) -> Option<usize> {
}
const MARKER_BASE64_BEGIN: &[u8] = b"base64,";
const MARKER_BASE64_END: &[u8] = b"' />"; //Search from end here with .rev()
const MARKER_BASE64_END: &[u8] = b"' /><p"; //Search from end here with .rev()
/// Find the base64 page bounds in this array
pub(super) fn find_bounds(from: impl AsRef<[u8]>) -> Result<Range<usize>, error::DecodeError>

Loading…
Cancel
Save