Sha256: a7d9c688fc738af2241f3dce39e343d517c3930174f7edcf2580b380e3575c99

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

#! /usr/bin/env ruby
# coding: utf-8

# Command 'sculd' can show events and tasks.
# Events include schedule and deadline(start and end).
# Tasks  include deadline, reminder and todo.

SCULD_DAT = "#{ENV['HOME']}/.sculd.dat"

require "pp"
require "optparse"
require "rubygems"
gem "sculd"
require "sculd"

# option analysis
OPTS = {}
op = OptionParser.new
op.on("-e day", "--event days", "Show events."){|v| OPTS[:event] = v.to_i}
op.on("-t num", "--task num"  , "Show tasks." ){|v| OPTS[:task ] = v.to_i}
op.on("-f file", "--file datafile", "Indicate file."){|v| OPTS[:file] = v}
op.parse!(ARGV)

#num_day  = ARGV.shift.to_i
#num_task = ARGV.shift.to_i
OPTS[:event] ||= 0
OPTS[:task ] ||= 0

if (( OPTS[:event] == 0) &&( OPTS[:task ] == 0))
  puts "USAGE: sculd -e 7 -t 10"
  exit
end

file = OPTS[:file]
file ||= SCULD_DAT

unless FileTest.exist? file
#  lines = File.open(file, "r").readlines
#rescue
  puts "Not found #{file}. Exit."
  exit
end

begin
  sm = Sculd::Manager.new(file)
rescue Sculd::Manager::LoadError
  puts "Exit."
  exit
end
io = $stdout
sm.show(OPTS[:event], OPTS[:task], io)

#while (true)
#  s.show(OPTS[:event], OPTS[:task])
#  command = STDIN.gets
#  case
#  when command == 
#  end
#end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sculd-0.0.3 bin/sculd
sculd-0.0.2 bin/sculd