Class: Pomodoro::Commands::Describe

Inherits:
Command
  • Object
show all
Defined in:
lib/pomodoro/commands/describe.rb

Overview

This is much faster, we could create a standalone script for it, but the main issue is how to get the path to en.yml. Currently the performance is not an issue, but leaving it for now.

puts YAML.load_file('i18n/en.yml')['commands'].reduce(Array.new) { |lines, (name, command)| if command && command['description'] lines << [name, command['description']].join(':') end

lines }

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Pomodoro::Commands::Command

Instance Method Details

#runObject


16
17
18
19
20
21
# File 'lib/pomodoro/commands/describe.rb', line 16

def run
  puts Pomodoro::Commander.commands.map { |key, cmd|
    next unless cmd.description
    "#{key}:#{cmd.description.gsub("'", "''")}"
  }.compact.join("\n")
end