This commit is contained in:
Matteo Paonessa 2023-04-12 00:09:35 +02:00
parent 4395e2c41a
commit a438dd502b
5 changed files with 99 additions and 83 deletions

152
Cargo.lock generated
View File

@ -46,7 +46,7 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"hermit-abi 0.1.19",
"libc",
"winapi",
]
@ -57,18 +57,24 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bit-vec"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]]
name = "bitflags"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "bitvec"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
dependencies = [
"funty",
"radium",
"tap",
"wyz",
]
[[package]]
name = "bytemuck"
version = "1.7.2"
@ -89,11 +95,11 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]]
name = "caesiumclt"
version = "0.19.1"
version = "0.19.2"
dependencies = [
"human_bytes",
"indicatif",
"infer 0.12.0",
"infer",
"libcaesium",
"num_cpus",
"rand",
@ -167,24 +173,6 @@ dependencies = [
"os_str_bytes",
]
[[package]]
name = "cloudflare-zlib"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cfcefb5df07f146eb15756342a135eb7d76b8bb609eff9c111f7539d060f94d"
dependencies = [
"cloudflare-zlib-sys",
]
[[package]]
name = "cloudflare-zlib-sys"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2040b6d1edfee6d75f172d81e2d2a7807534f3f294ce18184c70e7bb0105cd6f"
dependencies = [
"cc",
]
[[package]]
name = "color_quant"
version = "1.1.0"
@ -327,7 +315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
dependencies = [
"crc32fast",
"miniz_oxide 0.5.1",
"miniz_oxide",
]
[[package]]
@ -336,6 +324,12 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "funty"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
[[package]]
name = "getrandom"
version = "0.2.7"
@ -400,6 +394,15 @@ dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "human_bytes"
version = "0.4.1"
@ -424,11 +427,13 @@ dependencies = [
[[package]]
name = "imagequant"
version = "4.0.2"
source = "git+https://github.com/Lymphatus/libimagequant?rev=67f1686#67f1686bfe55b9dda06760089f2f6720f3f7eeeb"
version = "4.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f332f82fc531b53cffa3181c14f7beb5b6c33932d68bb0c2fa4fd583553fca64"
dependencies = [
"arrayvec",
"noisy_float",
"num_cpus",
"once_cell",
"rayon",
"rgb",
@ -443,7 +448,7 @@ checksum = "b19358258d99a5fc34466fed27a5318f92ae636c3e36165cf9b1e87b5b6701f0"
dependencies = [
"bytes",
"crc32fast",
"miniz_oxide 0.5.1",
"miniz_oxide",
]
[[package]]
@ -470,18 +475,9 @@ dependencies = [
[[package]]
name = "infer"
version = "0.9.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f178e61cdbfe084aa75a2f4f7a25a5bb09701a47ae1753608f194b15783c937a"
dependencies = [
"cfb",
]
[[package]]
name = "infer"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3"
checksum = "f551f8c3a39f68f986517db0d1759de85881894fdc7db798bd2a9df9cb04b7fc"
dependencies = [
"cfb",
]
@ -530,15 +526,15 @@ checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "libcaesium"
version = "0.10.0"
source = "git+https://github.com/Lymphatus/libcaesium?tag=0.10.1#a71a855b9eb76451f46cfb0d171da0a39c07829e"
version = "0.10.2"
source = "git+https://github.com/Lymphatus/libcaesium?tag=0.10.2#2b69935fc9dacc0ff0a13d1a821a416cca197190"
dependencies = [
"bytes",
"gifsicle",
"image",
"imagequant",
"img-parts",
"infer 0.9.0",
"infer",
"libc",
"lodepng",
"mozjpeg-sys",
@ -548,18 +544,18 @@ dependencies = [
[[package]]
name = "libdeflate-sys"
version = "0.10.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43afa5b192ff058426ba20a4f35c290ef402478d6045ac934ac15aa947a3898d"
checksum = "cb6784b6b84b67d71b4307963d456a9c7c29f9b47c658f533e598de369e34277"
dependencies = [
"cc",
]
[[package]]
name = "libdeflater"
version = "0.10.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e656b7960ec49e864badc7ad1b810427a7ac8b78511a699ce5cdc3ead0b32e5b"
checksum = "d8e285aa6a046fd338b2592c16bee148b2b00789138ed6b7bb56bb13d585050d"
dependencies = [
"libdeflate-sys",
]
@ -613,15 +609,6 @@ dependencies = [
"adler",
]
[[package]]
name = "miniz_oxide"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
dependencies = [
"adler",
]
[[package]]
name = "mozjpeg-sys"
version = "1.0.2"
@ -684,11 +671,11 @@ dependencies = [
[[package]]
name = "num_cpus"
version = "1.13.0"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [
"hermit-abi",
"hermit-abi 0.2.6",
"libc",
]
@ -700,9 +687,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
[[package]]
name = "once_cell"
version = "1.13.0"
version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "os_str_bytes"
@ -712,14 +699,12 @@ checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
[[package]]
name = "oxipng"
version = "6.0.1"
version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a40d437cd5308cba163907008d4c91a0280fc3b1ec1265dd20820e739002f4d9"
checksum = "630638e107fb436644c300e781d3f17e1b04656138ba0d40564be4be3b06db32"
dependencies = [
"bit-vec",
"bitvec",
"clap 3.2.22",
"cloudflare-zlib",
"crc",
"crossbeam-channel",
"filetime",
"image",
@ -727,9 +712,9 @@ dependencies = [
"itertools",
"libdeflater",
"log",
"miniz_oxide 0.6.2",
"rayon",
"rgb",
"rustc-hash",
"rustc_version",
"stderrlog",
"wild",
@ -745,7 +730,7 @@ dependencies = [
"bitflags",
"crc32fast",
"deflate",
"miniz_oxide 0.5.1",
"miniz_oxide",
]
[[package]]
@ -796,6 +781,12 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "radium"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
[[package]]
name = "rand"
version = "0.8.5"
@ -868,6 +859,12 @@ dependencies = [
"bytemuck",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc_version"
version = "0.4.0"
@ -957,6 +954,12 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "tap"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "termcolor"
version = "1.1.2"
@ -1158,6 +1161,15 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "wyz"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
dependencies = [
"tap",
]
[[package]]
name = "zopfli"
version = "0.7.1"

View File

@ -1,6 +1,6 @@
[package]
name = "caesiumclt"
version = "0.19.1"
version = "0.19.2"
authors = ["Matteo Paonessa <matteo.paonessa@gmail.com>"]
edition = "2021"
@ -10,8 +10,8 @@ structopt = "0.3"
indicatif = "0.17"
walkdir = "2.3"
num_cpus = "1.13"
infer = "0.12.0"
infer = "0.13"
rayon = "1.5"
rand = "0.8"
human_bytes = { version = "0.4", default-features = false }
libcaesium = { git = "https://github.com/Lymphatus/libcaesium", tag = "0.10.1" }
libcaesium = { git = "https://github.com/Lymphatus/libcaesium", tag = "0.10.2" }

View File

@ -1,5 +1,5 @@
## Caesium CommandLineTools
###### caesium-clt - v0.19.0
###### caesium-clt - v0.19.2
###### REQUIREMENTS
* [Rust](https://www.rust-lang.org/tools/install)

View File

@ -43,10 +43,16 @@ fn main() {
};
rayon::ThreadPoolBuilder::new().num_threads(cpus).build_global().unwrap_or_default();
if dry_run {
log("Running in dry run mode", 0, Notice, verbose);
} else {
match fs::create_dir_all(output_dir.clone()) {
Ok(_) => {}
Err(_) => log("Cannot create output path. Check your permissions.", 201, Error, verbose)
}
}
let (base_path, files) = scanfiles::scanfiles(args, opt.recursive);
@ -234,10 +240,12 @@ fn main() {
total_compressed_files += 1;
} else {
total_compressed_size += result.original_size as f64;
if !dry_run {
total_errors += 1;
log(format!("File {} was not compressed. Reason: {}", result.path, result.error).as_str(), 210, Warning, verbose);
}
}
total_original_size += result.original_size as f64;
});

View File

@ -90,8 +90,4 @@ fn validate_opts(opt: &Opt) {
if args.is_empty() {
log("Please provide at least one file or folder.", 101, Error, verbose);
}
if !opt.output.is_dir() {
log("Please provide a folder as output path.", 102, Error, verbose);
}
}