Module: Todo

Defined in:
lib/tasky.rb,
lib/tasky/version.rb

Defined Under Namespace

Classes: Options, Task

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.editObject



60
61
62
# File 'lib/tasky.rb', line 60

def edit
  exec("#{editor} #{Todo::Task.file}")
end

.editorObject



64
65
66
# File 'lib/tasky.rb', line 64

def editor
  ENV['VISUAL'] || ENV['EDITOR'] || 'vim'
end

.helpObject



68
69
70
71
# File 'lib/tasky.rb', line 68

def help
  puts 'Usage: todo [options] <args>'
  exit
end


52
53
54
55
56
57
58
# File 'lib/tasky.rb', line 52

def print_tasks(status = :todo)
  pattern = status == :todo ? /^\[x/ : /^\[ /
  File.open(Task.file).each_line do |l|
    puts(l) unless l[pattern]
  end
  exit
end

.start(args) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/tasky.rb', line 44

def start(args)
  options = Options.parse args

  @task = Task.new args

  @task.save
end

.versionObject



73
74
75
# File 'lib/tasky.rb', line 73

def version
  VERSION
end