feat: update help message

This commit is contained in:
2023-02-11 00:11:03 +08:00
parent 1e9af40ea9
commit 1f23f684a4
2 changed files with 18 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ name = "runrs"
version = "0.1.12"
edition = "2018"
license = "MIT/Apache-2.0"
description = "Run Rust Scripts"
description = "A Tool for Run Rust Scripts"
readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -16,7 +16,7 @@ fn main() {
let args = env::args().skip(1).collect::<Vec<_>>();
if args.is_empty() {
failure_and_exit!("runrs v{}, need arguments, `runrs --help` for help", env!("CARGO_PKG_VERSION"));
failure_and_exit!("runrs v{}, need arguments, `runrs -h` or `runrs --help` for help", env!("CARGO_PKG_VERSION"));
}
let first_argument = args.get(0).unwrap_or_else(|| failure_and_exit!("Must assign a script file name"));
if first_argument == "--help" || first_argument == "-h" {
@@ -95,27 +95,30 @@ fn write_script_file_to_src(script_file: &str, cache_script_bin_name: &str) {
fn print_help() {
println!(r##"{} v{} - {}
Help:
runrs -h|--help
Show help:
$ runrs -h|--help
Show template:
runrs -t|--template
$ runrs -t|--template
Run Rust Script:
runrs <script.rs> [arguments]
Run script:
$ runrs <script.rs> [arguments]
Binaries dir:
~/Library/Caches/rust-script/binaries/release/
Environment variables:
| Variable | Description |
| -------------------- | ------------------------------------------------------------ |
| HOME | User home, default by OS system |
| RUNRS_SKIP_CACHE | Skip compiled cached file, bool , turn on true, yes, on or 1 |
| RUNRS_REBUILD | Force rebuild, bool |
| RUNRS_SILENT_BUILD | Build new binary in silent mode, bool |
| RUNRS_RUST_SCRIPT | rust_script command line bin file |
| RUNRS_MAX_SCRIPT_LEN | Max script length, default 1MB |
┌──────────────────────┬────────────────────────────────────────────────┐
│ Variable │ Description │
├──────────────────────┼────────────────────────────────────────────────┤
│ HOME │ User home, default by OS system │
RUNRS_SKIP_CACHE │ Skip compiled cached file, `bool`
RUNRS_REBUILD │ Force rebuild, `bool`
RUNRS_SILENT_BUILD │ Build new binary in silent mode, `bool` │
RUNRS_RUST_SCRIPT │ `rust_script` command line bin file
│ RUNRS_MAX_SCRIPT_LEN │ Max script length, default 1MB │
└──────────────────────┴────────────────────────────────────────────────┘
> Type `bool`: `true`, `yes`, `on` or `1` for true, otherwise false
"##,
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"),