Class: Naginata::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/naginata/cli.rb

Defined Under Namespace

Classes: ActiveCheck, Fetch, Hosts, Init, LocalAbstract, Notification, RemoteAbstract, Services

Instance Method Summary collapse

Instance Method Details

#activecheck(*patterns) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/naginata/cli.rb', line 54

def activecheck(*patterns)
  if patterns.empty? and options.empty?
    help(:activecheck)
    exit(1)
  end
  require 'naginata/cli/active_check'
  CLI::ActiveCheck.new(options.merge(patterns: patterns)).execute
end

#fetchObject



65
66
67
68
# File 'lib/naginata/cli.rb', line 65

def fetch
  require 'naginata/cli/fetch'
  CLI::Fetch.new(options).execute
end

#hosts(*patterns) ⇒ Object



75
76
77
78
79
80
81
82
# File 'lib/naginata/cli.rb', line 75

def hosts(*patterns)
  if patterns.empty? and !options[:all_hosts]
    help(:hosts)
    exit(1)
  end
  require 'naginata/cli/hosts'
  CLI::Hosts.new(options.merge(patterns: patterns)).execute
end

#initObject



22
23
24
25
# File 'lib/naginata/cli.rb', line 22

def init
  require 'naginata/cli/init'
  CLI::Init.new(options).execute
end

#notification(*patterns) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/naginata/cli.rb', line 36

def notification(*patterns)
  if patterns.empty? and options.empty?
    help(:notification)
    exit(1)
  end
  require 'naginata/cli/notification'
  CLI::Notification.new(options.merge(patterns: patterns)).execute
end

#services(*patterns) ⇒ Object



90
91
92
93
94
95
96
97
# File 'lib/naginata/cli.rb', line 90

def services(*patterns)
  if patterns.empty? and !options[:all_hosts]
    help(:services)
    exit(1)
  end
  require 'naginata/cli/services'
  CLI::Services.new(options.merge(patterns: patterns)).execute
end

#versionObject



15
16
17
18
# File 'lib/naginata/cli.rb', line 15

def version
  require 'naginata/version'
  Naginata.ui.info "Naginata version #{Naginata::VERSION}"
end