Skip to content

Commit

Permalink
fix issue:
Browse files Browse the repository at this point in the history
* #5
* #21
  • Loading branch information
baoyachi committed Dec 21, 2020
1 parent df05249 commit 64409fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ In your `cargo.toml` `packgae` with package add with below config
build = "build.rs"

[dependencies]
shadow-rs = "0.4"
shadow-rs = "0.5"

[build-dependencies]
shadow-rs = "0.4"
shadow-rs = "0.5"
```

## step 2
In your project add file `build.rs`,then add with below config
```rust
fn main() -> shadow_rs::SdResult<()> {
shadow_rs::Shadow::new()
shadow_rs::new()
}
```

Expand All @@ -71,6 +71,7 @@ The `build` mod just we use `shadow!(build)` generated.

```rust
fn main() {
println!("{}",build::version());//print version() method
println!("{}",build::BRANCH); //master
println!("{}",build::SHORT_COMMIT);//8405e28e
println!("{}",build::COMMIT_HASH);//8405e28e64080a09525a6cf1b07c22fcaf71a5c5
Expand All @@ -97,6 +98,7 @@ And you can also use const with [clap](https://github.com/baoyachi/shadow-rs/blo
## Support const table
| const | example |
| ------ | ------ |
| version() | master/develop |
| BRANCH | master/develop |
| SHORT_COMMIT | 8405e28e |
| COMMIT_HASH | 8405e28e64080a09525a6cf1b07c22fcaf71a5c5 |
Expand Down
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@
//! build = "build.rs"
//!
//! [dependencies]
//! shadow-rs = "0.4"
//! shadow-rs = "0.5"
//!
//! [build-dependencies]
//! shadow-rs = "0.4"
//! shadow-rs = "0.5"
//! ```
//!
//! ## step 2
//! In your project add file `build.rs`,then add with below config
//!
//! ```ignore
//! fn main() -> shadow_rs::SdResult<()> {
//! shadow_rs::Shadow::new()
//! shadow_rs::new()
//! }
//! ```
//!
Expand All @@ -82,6 +82,7 @@
//!
//! ```ignore
//! fn main(){
//! println!("{}",build::version); //print version() method
//! println!("{}",build::BRANCH); //master
//! println!("{}",build::SHORT_COMMIT);//8405e28e
//! println!("{}",build::COMMIT_HASH);//8405e28e64080a09525a6cf1b07c22fcaf71a5c5
Expand Down

0 comments on commit 64409fa

Please sign in to comment.