Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/junegunn/srsly
SRSLY? NO!
https://github.com/junegunn/srsly
Last synced: 28 days ago
JSON representation
SRSLY? NO!
- Host: GitHub
- URL: https://github.com/junegunn/srsly
- Owner: junegunn
- License: mit
- Created: 2013-02-09T05:59:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-21T01:43:32.000Z (about 11 years ago)
- Last Synced: 2024-09-17T03:08:23.517Z (about 2 months ago)
- Language: Ruby
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
```
..............................................
..####...#####....####...##....##..##...####..
.##......##..##..##......##.....####...##..##.
..####...#####....####...##......##.......##..
.....##..##..##......##..##......##......##...
..####...##..##...####...######..##......##...
..............................................
``````ruby
require 'srsly'r = SRSLY? # Default "Are you sure (Y/N)?" message
r = SRSLY? nil => :eof # Returns :eof on EOF (nil)r = SRSLY? 'Continue (Y/N)? ' # Custom message
r = SRSLY? 'Continue (Y/N)? ', nil => :eof # Returns :eof on EOFr = SRSLY? 'Seriously (Y/N/A)? ',
# Expected responses (Regexp or String)
/^y/i => true,
/^n/i => false,
/^a/i => :all,
# Other options
:error => 'Invalid input. Seriously (Y/N/A)? ',
:tries => 5,
:in => $stdin,
:out => $stdoutr = SRSLY? "A or B? ",
'A' => :a,
'B' => :b,
nil => :quit,
:tries => 5,
:error => proc { |got, try, total| print "#{got}? Try again (#{try}/#{total}) " },
:out => proc { |msg| print msg + '>> ' }
```