diff options
author | Alexander Kjäll <alexander.kjall@gmail.com> | 2023-01-27 20:08:11 +0100 |
---|---|---|
committer | andy.boot <bootandy@gmail.com> | 2023-01-27 22:45:45 +0000 |
commit | fdbed14334a9c051e8dadce24aaa492aa9cc80c5 (patch) | |
tree | 6f0adecb447b1926f323d812f8bf242c6e291e34 | |
parent | 810cc8b6045853093f65bf5bfc97689890c6ca6b (diff) |
generate a man page as part of the build
-rw-r--r-- | Cargo.lock | 17 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | build.rs | 9 | ||||
-rw-r--r-- | man-page/dust.1 | 84 |
4 files changed, 111 insertions, 0 deletions
@@ -115,6 +115,16 @@ dependencies = [ ] [[package]] +name = "clap_mangen" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "105180c05a72388d5f5e4e4f6c79eecb92497bda749fa8f963a16647c5d5377f" +dependencies = [ + "clap", + "roff", +] + +[[package]] name = "config-file" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -217,6 +227,7 @@ dependencies = [ "atty", "clap", "clap_complete", + "clap_mangen", "config-file", "directories", "lscolors", @@ -544,6 +555,12 @@ dependencies = [ ] [[package]] +name = "roff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316" + +[[package]] name = "rustix" version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -52,6 +52,7 @@ tempfile = "=3" [build-dependencies] clap = "3.2.17" clap_complete = "3.2.4" +clap_mangen = "0.1" [[test]] name = "integration" @@ -1,5 +1,8 @@ use clap_complete::{generate_to, shells::*}; use std::io::Error; +use std::path::Path; +use std::fs::File; +use clap_mangen::Man; include!("src/cli.rs"); @@ -14,5 +17,11 @@ fn main() -> Result<(), Error> { generate_to(PowerShell, &mut cmd, app_name, outdir)?; generate_to(Elvish, &mut cmd, app_name, outdir)?; + let file = Path::new("man-page").join("dust.1"); + std::fs::create_dir("man-page"); + let mut file = File::create(&file)?; + + Man::new(cmd).render(&mut file)?; + Ok(()) } diff --git a/man-page/dust.1 b/man-page/dust.1 new file mode 100644 index 0000000..69445f2 --- /dev/null +++ b/man-page/dust.1 @@ -0,0 +1,84 @@ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.TH Dust 1 "Dust 0.8.3" +.SH NAME +Dust \- Like du but more intuitive +.SH SYNOPSIS +\fBDust\fR [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fB\-d\fR|\fB\-\-depth\fR] [\fB\-n\fR|\fB\-\-number\-of\-lines\fR] [\fB\-p\fR|\fB\-\-full\-paths\fR] [\fB\-X\fR|\fB\-\-ignore\-directory\fR] [\fB\-L\fR|\fB\-\-dereference\-links\fR] [\fB\-x\fR|\fB\-\-limit\-filesystem\fR] [\fB\-s\fR|\fB\-\-apparent\-size\fR] [\fB\-r\fR|\fB\-\-reverse\fR] [\fB\-c\fR|\fB\-\-no\-colors\fR] [\fB\-b\fR|\fB\-\-no\-percent\-bars\fR] [\fB\-z\fR|\fB\-\-min\-size\fR] [\fB\-\-skip\-total\fR] [\fB\-f\fR|\fB\-\-filecount\fR] [\fB\-i\fR|\fB\-\-ignore_hidden\fR] [\fB\-v\fR|\fB\-\-invert\-filter\fR] [\fB\-e\fR|\fB\-\-filter\fR] [\fB\-t\fR|\fB\-\-file_types\fR] [\fB\-w\fR|\fB\-\-terminal_width\fR] [\fB\-H\fR|\fB\-\-si\fR] [\fB\-P\fR|\fB\-\-no\-progress\fR] [\fB\-D\fR|\fB\-\-only\-dir\fR] [\fIinputs\fR] +.SH DESCRIPTION +Like du but more intuitive +.SH OPTIONS +.TP +\fB\-h\fR, \fB\-\-help\fR +Print help information +.TP +\fB\-V\fR, \fB\-\-version\fR +Print version information +.TP +\fB\-d\fR, \fB\-\-depth\fR +Depth to show +.TP +\fB\-n\fR, \fB\-\-number\-of\-lines\fR +Number of lines of output to show. (Default is terminal_height \- 10) +.TP +\fB\-p\fR, \fB\-\-full\-paths\fR +Subdirectories will not have their path shortened +.TP +\fB\-X\fR, \fB\-\-ignore\-directory\fR +Exclude any file or directory with this name +.TP +\fB\-L\fR, \fB\-\-dereference\-links\fR +dereference sym links \- Treat sym links as directories and go into them +.TP +\fB\-x\fR, \fB\-\-limit\-filesystem\fR +Only count the files and directories on the same filesystem as the supplied directory +.TP +\fB\-s\fR, \fB\-\-apparent\-size\fR +Use file length instead of blocks +.TP +\fB\-r\fR, \fB\-\-reverse\fR +Print tree upside down (biggest highest) +.TP +\fB\-c\fR, \fB\-\-no\-colors\fR +No colors will be printed (Useful for commands like: watch) +.TP +\fB\-b\fR, \fB\-\-no\-percent\-bars\fR +No percent bars or percentages will be displayed +.TP +\fB\-z\fR, \fB\-\-min\-size\fR +Minimum size file to include in output +.TP +\fB\-\-skip\-total\fR +No total row will be displayed +.TP +\fB\-f\fR, \fB\-\-filecount\fR +Directory \*(Aqsize\*(Aq is number of child files/dirs not disk size +.TP +\fB\-i\fR, \fB\-\-ignore_hidden\fR +Do not display hidden files +.TP +\fB\-v\fR, \fB\-\-invert\-filter\fR +Exclude filepaths matching this regex. To ignore png files type: \-v "\\.png$" +.TP +\fB\-e\fR, \fB\-\-filter\fR +Only include filepaths matching this regex. For png files type: \-e "\\.png$" +.TP +\fB\-t\fR, \fB\-\-file_types\fR +show only these file types +.TP +\fB\-w\fR, \fB\-\-terminal_width\fR +Specify width of output overriding the auto detection of terminal width +.TP +\fB\-H\fR, \fB\-\-si\fR +print sizes in powers of 1000 (e.g., 1.1G) +.TP +\fB\-P\fR, \fB\-\-no\-progress\fR +Disable the progress indication. +.TP +\fB\-D\fR, \fB\-\-only\-dir\fR +Only directories will be displayed. +.TP +[\fIinputs\fR] + +.SH VERSION +v0.8.3 |