Class: OTask

Inherits:
Object
  • Object
show all
Defined in:
lib/otask.rb,
lib/version.rb

Constant Summary collapse

VERSION =
'0.2.4'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments, stdin) ⇒ OTask



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/otask.rb', line 14

def initialize(arguments, stdin)
  @arguments = arguments
  @stdin = stdin

  # Set defaults
  @options = OpenStruct.new
  @options.verbose = false
  @options.quiet = false
  @options.list = false
  @options.completion = false

  of = app('OmniFocus')
  @dd = of.default_document
  # TO DO - add additional defaults
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/otask.rb', line 12

def options
  @options
end

Instance Method Details

#runObject

Parse options, check arguments, then process the command



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/otask.rb', line 31

def run
  if parsed_options?
    usage_and_exit unless arguments_valid?
  end

  if parsed_options? && arguments_valid?
    if @options.verbose
      puts "Start at #{DateTime.now}\n\n"
      puts "--Options--------------------"
      output_options if @options.verbose # [Optional]
      puts "--Task-Properties------------"
    end
    process_arguments
    process_command

    puts "\nFinished at #{DateTime.now}" if @options.verbose
  else
    usage_and_exit
  end

end