Skip to content

Commit 4fb19c7

Browse files
committed
docs: Make library usage example easier to follow
1 parent eee9ae6 commit 4fb19c7

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,28 @@ Options:
4242

4343
## Library Usage
4444

45+
In your `Cargo.toml` file.
46+
47+
```toml
48+
[dependencies]
49+
git-warp-time = "0.5"
50+
```
51+
52+
Then use the crate functions and types in your project something like this:
53+
4554
```rust
4655
use git_warp_time::{get_repo, reset_mtime};
47-
let repo = get_repo().unwrap();
48-
let mut paths = git_warp_time::FileSet::new();
49-
paths.insert("foo.txt".to_string());
50-
let mut opts = git_warp_time::Options::new();
51-
opts.verbose(true).paths(Some(paths));
52-
let files = reset_mtime(repo, opts).unwrap();
53-
println!("Actioned files: {:?}", files);
56+
use git_warp_time::{FileSet, Options};
57+
58+
fn main() {
59+
let repo = get_repo().unwrap();
60+
let mut paths = FileSet::new();
61+
paths.insert("foo.txt".to_string());
62+
let mut opts = Options::new();
63+
opts.verbose(true).paths(Some(paths));
64+
let files = reset_mtime(repo, opts).unwrap();
65+
println!("Actioned files: {:?}", files);
66+
}
5467
```
5568

5669
# The story

0 commit comments

Comments
 (0)