https://github.com/petems/passwordgetter
https://github.com/petems/passwordgetter
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/petems/passwordgetter
- Owner: petems
- License: mit
- Created: 2019-01-10T16:10:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-13T20:25:58.000Z (over 6 years ago)
- Last Synced: 2025-01-12T16:37:49.402Z (6 months ago)
- Language: Go
- Homepage:
- Size: 1.08 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# passwordgetter
A basic cli tool that uses `golang.org/x/crypto/ssh/terminal`'s method `terminal.ReadPassword` to get a password.
## Purpose
This was to help me understand stubbing the interface for stdin capture, as I've been writing tests for a lot of CLI apps recently.
The idea was from this StackOverflow question: https://stackoverflow.com/questions/38573176/mocking-crypto-ssh-terminal
And the code was based on https://github.com/isaacasensio/memo - which already had some stubbing in it!
## Installation
#### Via Go
```bash
$ go get github.com/petems/passwordgetter
```## Usage
```console
$ passwordgetter
Enter password:Your password was: hunter2
```