Skip to content

Commit

Permalink
simplifies readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Kleinespel authored Jul 16, 2017
1 parent 7084be1 commit 334978d
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,22 @@ Add `rpassword` as a dependency in Cargo.toml:
rpassword = "0.4"
```

Import the `rpassword` crate and use the `promt_password_stdout()` to show a message on `stdout` and read a password into a `String`:
Use `rpassword` within your code:

```rust
extern crate rpassword;

fn main() {
// Prompt for a password
let pass = rpassword::prompt_password_stdout("Password: ").unwrap();
println!("Your password is {}", pass);
}
```

You can also read a password without prompting:

```rust
extern crate rpassword;

fn main() {

// Read a password without prompt
let pass = rpassword::read_password().unwrap();
println!("Your password is {}", pass);
}
```

Finally, you can read strings with a single line, and without the terminating
newline that `read_line` would add:
```rust
extern crate rpassword;

fn main() {
let response = rpassword::read_response().unwrap();
println!("Your response is {}", response);
}
```

Check [examples/example.rs](examples/example.rs) for a few more examples.

## Contributors
Expand Down

0 comments on commit 334978d

Please sign in to comment.