Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cksum: move help strings to markdown file #4516

Merged
merged 3 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/uu/cksum/cksum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# cksum

```
cksum [OPTIONS] [FILE]...
```

Print CRC and size for each file

## After Help

DIGEST determines the digest algorithm and default output format:

- `-a=sysv`: (equivalent to sum -s)
- `-a=bsd`: (equivalent to sum -r)
- `-a=crc`: (equivalent to cksum)
- `-a=md5`: (equivalent to md5sum)
- `-a=sha1`: (equivalent to sha1sum)
- `-a=sha224`: (equivalent to sha224sum)
- `-a=sha256`: (equivalent to sha256sum)
- `-a=sha384`: (equivalent to sha384sum)
- `-a=sha512`: (equivalent to sha512sum)
- `-a=blake2b`: (equivalent to b2sum)
- `-a=sm3`: (only available through cksum)
24 changes: 5 additions & 19 deletions src/uu/cksum/src/cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ use std::iter;
use std::path::Path;
use uucore::{
error::{FromIo, UResult},
format_usage,
format_usage, help_about, help_section, help_usage,
sum::{
div_ceil, Blake2b, Digest, DigestWriter, Md5, Sha1, Sha224, Sha256, Sha384, Sha512, Sm3,
BSD, CRC, SYSV,
},
};

const USAGE: &str = "{} [OPTIONS] [FILE]...";
const ABOUT: &str = "Print CRC and size for each file";
const USAGE: &str = help_usage!("cksum.md");
const ABOUT: &str = help_about!("cksum.md");
const AFTER_HELP: &str = help_section!("after help", "cksum.md");

const ALGORITHM_OPTIONS_SYSV: &str = "sysv";
const ALGORITHM_OPTIONS_BSD: &str = "bsd";
Expand Down Expand Up @@ -205,21 +206,6 @@ mod options {
pub static ALGORITHM: &str = "algorithm";
}

const ALGORITHM_HELP_DESC: &str =
"DIGEST determines the digest algorithm and default output format:\n\
\n\
-a=sysv: (equivalent to sum -s)\n\
-a=bsd: (equivalent to sum -r)\n\
-a=crc: (equivalent to cksum)\n\
-a=md5: (equivalent to md5sum)\n\
-a=sha1: (equivalent to sha1sum)\n\
-a=sha224: (equivalent to sha224sum)\n\
-a=sha256: (equivalent to sha256sum)\n\
-a=sha384: (equivalent to sha384sum)\n\
-a=sha512: (equivalent to sha512sum)\n\
-a=blake2b: (equivalent to b2sum)\n\
-a=sm3: (only available through cksum)\n";

#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args.collect_ignore();
Expand Down Expand Up @@ -278,5 +264,5 @@ pub fn uu_app() -> Command {
ALGORITHM_OPTIONS_SM3,
]),
)
.after_help(ALGORITHM_HELP_DESC)
.after_help(AFTER_HELP)
}