Module: Lazybird::Cli::Commands
- Included in:
- CommandLine
- Defined in:
- lib/lazybird/cli/commands.rb
Instance Method Summary collapse
- #add(params) ⇒ Object
- #config(params) ⇒ Object
- #display_done ⇒ Object
- #exit(params) ⇒ Object
- #help(params) ⇒ Object
- #intro ⇒ Object
- #my_run(params) ⇒ Object
- #my_tasks(params) ⇒ Object
- #rem(params) ⇒ Object
- #run(params) ⇒ Object
- #setup(params) ⇒ Object
- #tasks(params) ⇒ Object
Instance Method Details
#add(params) ⇒ Object
15 16 17 18 |
# File 'lib/lazybird/cli/commands.rb', line 15 def add(params) @facade.add_task params.first display_done end |
#config(params) ⇒ Object
5 6 7 8 |
# File 'lib/lazybird/cli/commands.rb', line 5 def config(params) @facade.config(params) display_done end |
#display_done ⇒ Object
82 83 84 85 |
# File 'lib/lazybird/cli/commands.rb', line 82 def display_done 'done!'.green.display newline end |
#exit(params) ⇒ Object
42 43 44 |
# File 'lib/lazybird/cli/commands.rb', line 42 def exit(params) Kernel.exit(true) end |
#help(params) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/lazybird/cli/commands.rb', line 52 def help(params) begin "List of available commands: \n".yellow + "config ".bold + "consumer_key consumer_secret access_token access_token_secret".green + " \u{23ce} \n".white + "Configures twitter account (Should be the first step!)\n" + "tasks \u{23ce} \n".bold + "Displays a list of available tasks \n" + "my_tasks".bold + " \u{23ce} \n" + "Displays a list of your selected tasks \n" + "add ".bold + "task".green + " \u{23ce} \n".white + "Adds a task to be randomly tweeted\n" + "rem ".bold + "task".green + " \u{23ce} \n".white + "Removes a task from your list\n" + "run ".bold + "time".green + " \u{23ce} \n".white + "Sets how frequent we tweet (Ex: run 3h or run 1d or run 30m)\n" + "my_run ".bold + " \u{23ce} \n" + "Displays the current frequency of tweets \n" + "setup \u{23ce} \n".bold + "setups the app for the first time \n" + "exit \u{23ce} \n".bold + "Exits the app \n" end.display end |
#intro ⇒ Object
46 47 48 49 50 |
# File 'lib/lazybird/cli/commands.rb', line 46 def intro "Lazybird v#{Lazybird.version}\n".light_yellow + "by James Lopez <http://jameslopez.net> <https://github.com/bluegod/lazybird>\n".blue + 'Type: ' + "help \u{23ce}".bold + " for a list of commands.\n" end |
#my_run(params) ⇒ Object
37 38 39 40 |
# File 'lib/lazybird/cli/commands.rb', line 37 def my_run(params) @facade.run_info.green.display newline end |
#my_tasks(params) ⇒ Object
20 21 22 23 |
# File 'lib/lazybird/cli/commands.rb', line 20 def my_tasks(params) @facade.current_tasks.join("\n").green.display newline end |
#rem(params) ⇒ Object
25 26 27 28 |
# File 'lib/lazybird/cli/commands.rb', line 25 def rem(params) @facade.rem_task(params.first) display_done end |
#run(params) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/lazybird/cli/commands.rb', line 30 def run(params) cursor = -> () do display_prompt end @facade.run_tasks(params, &cursor) end |
#setup(params) ⇒ Object
10 11 12 13 |
# File 'lib/lazybird/cli/commands.rb', line 10 def setup(params) @facade.init display_done end |
#tasks(params) ⇒ Object
76 77 78 79 80 |
# File 'lib/lazybird/cli/commands.rb', line 76 def tasks(params) @facade.tasks.each do |k, v| puts "#{k}:".bold + " #{v['desc']}".green end end |