Class: Lbrt::CLI::Alert

Inherits:
Thor
  • Object
show all
Includes:
Utils::CLIHelper
Defined in:
lib/lbrt/cli/alert.rb

Constant Summary

Constants included from Utils::CLIHelper

Utils::CLIHelper::REGEXP_OPTIONS

Instance Method Summary collapse

Methods included from Utils::CLIHelper

#client

Instance Method Details

#apply(file) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/lbrt/cli/alert.rb', line 22

def apply(file)
  updated = client(Lbrt::Alert).apply(file)

  unless updated
    Lbrt::Logger.instance.info('No change'.intense_blue)
  end
end

#export(file = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/lbrt/cli/alert.rb', line 31

def export(file = nil)
  dsl = client(Lbrt::Alert).export

  if file.nil? or file == '-'
    puts dsl
  else
    open(file, 'wb') {|f| f.puts dsl }
  end
end

#listObject



9
10
11
# File 'lib/lbrt/cli/alert.rb', line 9

def list
  client(Lbrt::Alert).list
end

#pecoObject



16
17
18
# File 'lib/lbrt/cli/alert.rb', line 16

def peco
  client(Lbrt::Alert).peco
end