-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.rb
35 lines (30 loc) · 1.18 KB
/
cli.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Create a class to hold the new command definition. The class defined should
# match the file we are contained in.
class Onceover
module HelloWorld
class CLI
# Static method defining the new command to be added
def self.command
@cmd ||= Cri::Command.define do
name 'helloworld'
usage 'helloworld [--name NAME]'
summary "Hello, World! plugin for Onceover"
description <<-DESCRIPTION
This is a sample plugin to show you how to get started writing your own
plugins for onceover, The gateway drug to automated infrastructure testing
with Puppet
DESCRIPTION
option :n, :name, 'Who to say hello to', :argument => :optional
run do |opts, args, cmd|
# print a simple message - this is the point where you would
# normally call out to a library to do the real work
logger.info "Hello, #{opts[:name]||'World'}!"
end
end
end
end
end
end
# Register the new command with onceover. The method you add must match your
# own code
Onceover::CLI::Run.command.add_command(Onceover::HelloWorld::CLI.command)