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
========
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
$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'
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 'net/http'
class CLI < Thor
desc "get", "Gets a vm"
def get
say 'Get a vm here'
desc "get [operating system,...] [--withpe]", "Gets a VM"
option :withpe
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
desc "modify", "Modify a vm"
def modify
desc "modify [hostname]", "Modify a VM"
def modify(hostname)
say 'Modify a vm'
end
desc "list", "List all active vms"
desc "status", "List status of all active VMs"
def status
say 'List of active VMs'
end
desc "list", "List all open VMs"
def list
say 'Listing your vms'
say 'Listing open vms on vmpooler'
end
desc "release", "Schedules a vm for deletion"
def release
say 'Releases a vm'
desc "release [hostname]", "Schedules a VM for deletion"
def release(hostname)
say 'Releases a VM'
end
end
CLI.start(ARGV)