Skip to content

Instantly share code, notes, and snippets.

@hannesfostie
Created July 9, 2013 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hannesfostie/5ff199f13a24a7f71228 to your computer and use it in GitHub Desktop.
Save hannesfostie/5ff199f13a24a7f71228 to your computer and use it in GitHub Desktop.
require 'slop'
options = Slop.parse do
banner %{Usage: sock_admin COMMAND [OPTIONS]
Control Sock from the command line.
}
command 'chef' do
command 'last' do
on :h, :host=, "Get the time of the last Chef run for a host"
on :e, :environment=, "Set the Sock environment"
on :e, :env=, "Set the Sock environment"
run do |options, args|
output = "Getting last Chef run for #{options[:host]}"
output << " for environment #{options[:environment]}" if options[:environment]
output << " for environment #{options[:env]}" if options[:env]
puts output
end
end
command 'run' do
on :h, :host=, "Run Chef on a host"
on :e, :environment=, "Set the Sock environment"
on :e, :env=, "Set the Sock environment"
run do |options, args|
output = "Running Chef on host #{options[:host]}"
output << " for environment #{options[:environment]}" if options[:environment]
output << " for environment #{options[:env]}" if options[:env]
puts output
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment