Generate gzip-ed manpages

This commit is contained in:
Jack Grigg 2019-12-29 15:56:42 -06:00
parent 4be6245bde
commit 3fc6c679f9
No known key found for this signature in database
GPG key ID: 9E8255172BBF9898
3 changed files with 16 additions and 7 deletions

1
Cargo.lock generated
View file

@ -62,6 +62,7 @@ dependencies = [
"dialoguer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
"fuse_mt 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gumdrop 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hkdf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -96,6 +96,7 @@ time = { version = "0.1", optional = true }
zip = { version = "0.5", optional = true }
[dev-dependencies]
flate2 = "1"
man = "0.3"
quickcheck = "0.8"
quickcheck_macros = "0.8"

View file

@ -1,3 +1,4 @@
use flate2::{write::GzEncoder, Compression};
use man::prelude::*;
use std::fs::File;
use std::io::prelude::*;
@ -112,9 +113,11 @@ fn rage_page() {
);
let page = builder.render();
let mut file =
File::create("./target/rage.1").expect("Should be able to open file in target directory");
file.write_all(page.as_bytes())
let file = File::create("./target/rage.1.gz")
.expect("Should be able to open file in target directory");
let mut encoder = GzEncoder::new(file, Compression::best());
encoder
.write_all(page.as_bytes())
.expect("Should be able to write to file in target directory");
}
@ -146,9 +149,11 @@ fn rage_keygen_page() {
)
.render();
let mut file = File::create("./target/rage-keygen.1")
let file = File::create("./target/rage-keygen.1.gz")
.expect("Should be able to open file in target directory");
file.write_all(page.as_bytes())
let mut encoder = GzEncoder::new(file, Compression::best());
encoder
.write_all(page.as_bytes())
.expect("Should be able to write to file in target directory");
}
@ -200,9 +205,11 @@ fn rage_mount_page() {
)
.render();
let mut file = File::create("./target/rage-mount.1")
let file = File::create("./target/rage-mount.1.gz")
.expect("Should be able to open file in target directory");
file.write_all(page.as_bytes())
let mut encoder = GzEncoder::new(file, Compression::best());
encoder
.write_all(page.as_bytes())
.expect("Should be able to write to file in target directory");
}