Sha256: b0ad935b32af0ec4a9f22095100f3691d77656b5e04dc2a31169be08cc067390

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

#!/usr/bin/env ruby
require 'optparse'
require File.expand_path('../../lib/idid', __FILE__)

options = {}

OptionParser.new do |opts|
  # Show help screen
  opts.on( '-h', '--help', 'Display this screen' ) do
    puts opts
    exit
  end

  # Show list of done items
  list_desc = "Show done log for date. Default: today."
  options[:list] = nil
  opts.on('-l', '--list [YYYY-MM-DD]', list_desc) do |f|
    options[:list] = f || Time.now.strftime('%Y-%m-%d')
  end
end.parse!

if options[:list]
  puts Idid::Task.list options[:list]
else
  begin
    config = Idid::Configuration.new
  rescue
    config = Idid::Interactive.create_config
    config.write
    Idid::Interactive.status "Got your settings. Let's record your progress!"
  end

  if ARGV.any?
    task = Idid::Task.new ARGV.join " "
    task.save

    Idid::Delivery.new(config).email task.to_s
    Idid::Interactive.status "Got it! Let's get some more done!"
  else
    Idid::Interactive.fail "Shoot! An empty message cannot be send!"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
idid-0.0.4 bin/idid