secrets v0.1.2

Useful to get input on noecho, secrets, passwords, token, hints

Secrets

Build Status

Crystal shard to get secrets with hint and backspace support.

Secrets

Installation

Add this to your application's shard.yml:

dependencies:
  secrets:
    github: faustinoaq/secrets

Usage

require "secrets"

secret = Secrets.gets prompt: "Write your secret: "
puts "Your secret has #{secret.size} character(s)"

secrets-example

require "secrets"

secret = Secrets.gets prompt: "Write your secret: ", hint: "*", empty_error: "Empty input, Try again!"
puts "Your secret has #{secret.size} character(s)"

secrets-example-error

require "secrets"

secret = Secrets.gets prompt: "Write your secret: ", empty_error: "Retry!", retry: 3
if secret.empty?
  puts "Oh, no!, your secret is empty!"
else
  puts "Your secret has #{secret.size} character(s)"
end

secrets-example-error-retry

Development

Execute spec/ using:

crystal spec
Finished in 564.18 milliseconds
8 examples, 0 failures, 0 errors, 0 pending

Contributing

  1. Fork it ( https://github.com/faustinoaq/secrets/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • faustinoaq Faustino Aguilar - creator, maintainer
Repository

secrets

Owner
Statistic
  • 12
  • 1
  • 0
  • 3
  • 0
  • over 6 years ago
  • April 22, 2018
License

MIT License

Links
Synced at

Fri, 22 Nov 2024 07:51:32 GMT

Languages