Update CLI options

This commit is contained in:
Brian Cain 2014-10-28 22:57:48 -07:00
parent 99b03e2994
commit 51193ab4a6
4 changed files with 55 additions and 14 deletions

View file

@ -1,2 +1,16 @@
vmfloaty vmfloaty
======== ========
A CLI helper tool for Puppet Labs vmpooler to help you stay afloat.
## Install
```
gem install vmfloaty
```
## Usage
```
TODO
```

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require 'vmfloaty/cli' require 'vmfloaty'
Vmfloaty.new(ENV).start

View file

@ -1 +1,16 @@
require 'vmfloaty/cli' require 'vmfloaty/cli'
class Vmfloaty
def initialize(env)
@vmpooler_url = env['VMPOOLER_URL']
unless @vmpooler_url
@vmpooler_url = 'http://vcloud.delivery.puppetlabs.net/vm'
end
end
def start
CLI.start(ARGV)
end
end

View file

@ -1,25 +1,35 @@
require 'thor' require 'thor'
require 'net/http'
class CLI < Thor class CLI < Thor
desc "get", "Gets a vm" desc "get [operating system,...] [--withpe]", "Gets a VM"
def get option :withpe
say 'Get a vm here' def get(os)
say "vmpooler: #{@vmpooler_url}"
if options[:withpe]
say "Get a #{os} VM here and provision with PE verison #{options[:withpe]}"
else
say "Get a #{os} VM here"
end
end end
desc "modify", "Modify a vm" desc "modify [hostname]", "Modify a VM"
def modify def modify(hostname)
say 'Modify a vm' say 'Modify a vm'
end end
desc "list", "List all active vms" desc "status", "List status of all active VMs"
def list def status
say 'Listing your vms' say 'List of active VMs'
end end
desc "release", "Schedules a vm for deletion" desc "list", "List all open VMs"
def release def list
say 'Releases a vm' say 'Listing open vms on vmpooler'
end
desc "release [hostname]", "Schedules a VM for deletion"
def release(hostname)
say 'Releases a VM'
end end
end end
CLI.start(ARGV)