Class: Evertils::Controller::Get

Inherits:
Base
  • Object
show all
Defined in:
lib/evertils/controllers/get.rb

Constant Summary

Constants inherited from Base

Base::OK, Base::QUIT, Base::QUIT_SOFT

Instance Attribute Summary collapse

Attributes inherited from Base

#config, #request

Instance Method Summary collapse

Methods inherited from Base

#can_exec?, #exec, #initialize, #post_exec, #sample

Constructor Details

This class inherits a constructor from Evertils::Controller::Base

Instance Attribute Details

#fileObject

Returns the value of attribute file.



4
5
6
# File 'lib/evertils/controllers/get.rb', line 4

def file
  @file
end

#notebookObject

Get data about a notebook, prints titles of each child note



28
29
30
# File 'lib/evertils/controllers/get.rb', line 28

def notebook
  @notebook
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/evertils/controllers/get.rb', line 4

def title
  @title
end

Instance Method Details

#infoObject



48
49
50
51
52
# File 'lib/evertils/controllers/get.rb', line 48

def info
  @config.options.each_pair do |key, value|
    Notify.spit("#{key}: #{value}")
  end
end

#pre_execObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/evertils/controllers/get.rb', line 6

def pre_exec
  # command flag parser
  OptionParser.new do |opt|
    opt.banner = "evertils new note [...-flags]"

    opt.on("-t", "--title=TITLE", "Set a custom title") do |title|
      @title = title
    end

    opt.on("-f", "--file=PATH", "Attach a file to your custom note") do |file|
      @file = file
    end

    opt.on("-n", "--notebook=PBOOK", "Attach a file to your custom note") do |notebook|
      @notebook = notebook
    end
  end.parse!

  super
end