class Mailbot::Commands::List
Constants
- DEFAULT_MARKDOWN_FILE
Public Class Methods
new(argv)
click to toggle source
@param argv [Array] ARGV
# File lib/mailbot/commands/list.rb, line 8 def initialize(argv) @argv = argv end
Public Instance Methods
execute()
click to toggle source
List
all entries of the specified file
# File lib/mailbot/commands/list.rb, line 13 def execute puts Mailbot::Repository.new(file).entries.map { |entry| colorized_subject entry }.map(&:strip).join("\n") end
Private Instance Methods
colorized_subject(entry)
click to toggle source
# File lib/mailbot/commands/list.rb, line 19 def colorized_subject(entry) subject = entry.subject subject = "\033[32m#{subject}\033[0m" unless entry.synced? subject end
file()
click to toggle source
# File lib/mailbot/commands/list.rb, line 25 def file options[:file] || DEFAULT_MARKDOWN_FILE end
options()
click to toggle source
# File lib/mailbot/commands/list.rb, line 29 def options @options ||= Slop.parse!(@argv, help: true) do banner "Usage: #{$0} list [options]" on "file=", "Path to the markdown file to list" end end