📚 Add help message and update script metadata hashes due to main.rs changes

This commit is contained in:
2026-04-13 00:33:30 +08:00
parent 85b319d239
commit c51c2a2773
3 changed files with 25 additions and 7 deletions
+20 -2
View File
@@ -30,6 +30,24 @@ fn main() {
return; return;
} }
let first_arg = args.first(); let first_arg = args.first();
if let Some(first_arg) = first_arg {
if first_arg == "--help" || first_arg == "-h" {
println!(
r##"md.rs - Markdown render
md.rs -h|--help
cat README.md | md.rs
md.rs cheat:
md.rs cheat:xh
md.rs README.md
md.rs https://example.com/sample.md
"##
);
return;
}
}
match read_to_string(first_arg) { match read_to_string(first_arg) {
Ok(md) => { Ok(md) => {
termimad::print_text(&md); termimad::print_text(&md);
@@ -122,5 +140,5 @@ fn try_cheat_sheet(path: &str) -> Option<String> {
None None
} }
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260413T002526+08:00.MEUCIQDtbn9VsvXD5i0CDDpX // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260413T003310+08:00.MEYCIQDcX8y+GB4tGpZvp0TG
// vaa/uR8bjm5CuvKZFs9gIVFfxwIgYXGJkKom0g+uG6QB6jqi31d7Vtyg80SWmyRAi5aZCvk= // TOk6LT/J4cFXYOYG88Q3hx4S9QIhAK2IGN/5paueKYKdqO6ikPji6N4LBf4ssbunCM87XyLS
+3 -3
View File
@@ -82,11 +82,11 @@
}, },
"md.rs": { "md.rs": {
"script_name": "md.rs", "script_name": "md.rs",
"script_length": 4052, "script_length": 4391,
"script_sha256": "eaf9e006406250ae6841b62ea75d751826e42562e6117b505b77fc9f594cdff5", "script_sha256": "ccb11edad093e304ca01e0aca5d496c339f387d4e25dc89c6ffee25e0ea92968",
"script_full_url": "https://git.hatter.ink/rust-scripts/scriptbase/raw/branch/main/md-rs/src/main.rs", "script_full_url": "https://git.hatter.ink/rust-scripts/scriptbase/raw/branch/main/md-rs/src/main.rs",
"publish_time": 1775921621093, "publish_time": 1775921621093,
"update_time": 1776011164981 "update_time": 1776011608049
}, },
"myip.rs": { "myip.rs": {
"script_name": "myip.rs", "script_name": "myip.rs",
+2 -2
View File
@@ -46,8 +46,8 @@
}, },
"md-rs": { "md-rs": {
"script_name": "md-rs", "script_name": "md-rs",
"script_length": 4052, "script_length": 4391,
"script_sha256": "eaf9e006406250ae6841b62ea75d751826e42562e6117b505b77fc9f594cdff5" "script_sha256": "ccb11edad093e304ca01e0aca5d496c339f387d4e25dc89c6ffee25e0ea92968"
}, },
"myip-rs": { "myip-rs": {
"script_name": "myip-rs", "script_name": "myip-rs",