Class: GIF::CLI
- Inherits:
-
Thor
- Object
- Thor
- GIF::CLI
- Defined in:
- lib/gif/cli.rb
Instance Method Summary collapse
Instance Method Details
#list ⇒ Object
51 52 53 |
# File 'lib/gif/cli.rb', line 51 def list print_in_columns all_gifs end |
#random ⇒ Object
31 32 33 34 35 |
# File 'lib/gif/cli.rb', line 31 def random gif = all_gifs.sample copy_to_clipboard url_for(gif) say "Copied URL for #{gif} to your clipboard" end |
#search(string) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gif/cli.rb', line 38 def search(string) gifs = FuzzyMatch.new(all_gifs) gif = gifs.find(string) if gif copy_to_clipboard url_for(gif) say "Found #{gif}. Copied URL to clipboard." else say "No gif matching that string could be found" end end |
#setup ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gif/cli.rb', line 13 def setup unless [:inspect] if [:directory] and [:url_prefix] config['directory'] = [:directory] config['url_prefix'] = [:url_prefix] save_settings say "Saved settings." else config['directory'] = ask("What directory are your GIFs stored in?") config['url_prefix'] = ask("What is the URL prefix to add to the path of a GIF?") save_settings end else say config.to_yaml end end |