diff --git a/docs/README_CN.md b/docs/README_CN.md index ab77441..d26c809 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -45,8 +45,8 @@ ##### 从`Github`下载 ```toml -[dependencies.commander_rust] -git = "https://github.com/MSDimos/commander_rust" +[dependencies.commander-rust] +git = "https://github.com/MSDimos/commander-rust" branch = "master" ``` @@ -54,7 +54,7 @@ branch = "master" ```toml [dependencies] -commander_rust = "1.1.3" # 指定其他任意你需要的版本 +commander-rust = "1.1.3" # 指定其他任意你需要的版本 ``` #### 使用它 diff --git a/homepage/dist b/homepage/dist deleted file mode 160000 index 9a8c9b8..0000000 --- a/homepage/dist +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9a8c9b82f90d74d97b41fd855a6fc615786d7107 diff --git a/homepage/public/readme.html b/homepage/public/readme.html index f2fd190..f1bc553 100644 --- a/homepage/public/readme.html +++ b/homepage/public/readme.html @@ -303,7 +303,7 @@
For a long time, developing cli in Rust is difficult.
The community offers a wide range of solutions. Yes, they're excellent, but they're not very simple.
Inspired by commander.js & rocket.rs, the crate was born.
--version & --helpIf you want to use this crate, please guarantee that you have follow rules below:
Rust 2018 (full proc macro support is required, including [proc_macro] & [proc_macro_attribute])cargo (cargo will produce some environment variable according to Cargo.toml, we need that)Rust (because it's developed for Rust )As a reference, my versions are:
cargo: cargo 1.35.0-nightly (95b45eca1 2019-03-06)rustc: rustc 1.35.0-nightly (e68bf8ae1 2019-03-11)Linux kernal: 4.15.0-47-genericUbuntu: 16.04commander-rustTwo ways supported: from Github or crates.io.
-The difference between them is that Github is latest but unstable and crates.io is stable but might not be latest.
Githubxxxxxxxxxx[dependencies.commander_rust]git = "https://github.com/MSDimos/commander_rust"branch = "master"crates.ioxxxxxxxxxx[dependencies]commander_rust = "1.1.3" # or other version you want to installWe offer a simple but complete example, you can learn all through it.
+The difference between them is that Github is latest but unstable and crates.io is stable but might not be latest.
Githubxxxxxxxxxx[dependencies.commander-rust]git = "https://github.com/MSDimos/commander-rust"branch = "master"crates.ioxxxxxxxxxx[dependencies]commander_rust = "1.1.3" # or other version you want to installWe offer a simple but complete example, you can learn all through it. Yes, That's all. Very easy!
xxxxxxxxxx// this is required! Beacuse we used `run!()`, it's a proc_macro// Only five items you will useuse commander_rust::{ Cli, command, option, entry, run };// what's option? what's command? // See `commander.js` and document of `commander-rust` for more!// Note, types of parameters are not fixed, any type implemented `From<Raw>` is valid!// So you can even use `rmdir(dir: i32, other_dirs: Vec<i32>, cli: Cli)` here.// And `Cli` is not required! So you can miss it.// See document of `commander-rust` for more details.fn rmdir(dir: String, other_dirs: Option<Vec<String>>, cli: Cli) { // get value of no-parameter options, using `has` // get value if normal options, using `get`, `get_or`, `get_or_else` // `get_or` and `get_or_else` can be using for specifying default value // for the most time, I suggest you using `get_or` and `has`. let format = cli.get_or("format", String::new("%s")); if !cli.has("recursive") { let silently = cli.get_or("silently", false); if silently { // delete all files silently // just like `rm -rf /` } else { // tell the world I'm going to delete the files } } else { // delete files recursively is slowly // so drink a cup of coffee, relax. }}// options here are public, options above `#[command]` are privatefn main() { // Run it now!!!!! let app = run!(); // printing app is same as you inputting `--help`. println!("app is {:#?}", app);}try to input [pkg-name] --help.
version, description, cli-name of application are from Cargo.toml.
For instance:
xxxxxxxxxx# part of Cargo.toml[package]name = "example-test"version = "0.1.0"description = "Using for test"If you don't want to define a sub-command, you can use #[direct].
What's direct? In some situations, for instance,
if you want to develop a CLI which could be called like rm ./* -rf.
diff --git a/homepage/public/readme.md b/homepage/public/readme.md
index 7a8432c..e1d2c36 100644
--- a/homepage/public/readme.md
+++ b/homepage/public/readme.md
@@ -41,8 +41,8 @@ The difference between them is that `Github` is latest but unstable and `crates.
##### install from `Github`
```toml
-[dependencies.commander_rust]
-git = "https://github.com/MSDimos/commander_rust"
+[dependencies.commander-rust]
+git = "https://github.com/MSDimos/commander-rust"
branch = "master"
```
@@ -50,7 +50,7 @@ branch = "master"
```toml
[dependencies]
-commander_rust = "1.1.3" # or other version you want to install
+commander-rust = "1.1.3" # or other version you want to install
```
#### using it