lib/balancer/cli.rb in balancer-0.1.0 vs lib/balancer/cli.rb in balancer-0.2.0
- old
+ new
@@ -1,20 +1,34 @@
module Balancer
class CLI < Command
class_option :verbose, type: :boolean
class_option :noop, type: :boolean
- desc "hello NAME", "Say hello to NAME."
- long_desc Help.text(:hello)
- option :from, desc: "from person"
- def hello(name="you")
- puts "from: #{options[:from]}" if options[:from]
- puts "Hello #{name}"
+ desc "create NAME", "Create Load Balancer."
+ long_desc Help.text(:create)
+ # create_load_balancer options
+ option :subnets, type: :array, desc: "Subnets"
+ option :security_groups, type: :array, desc: "Security groups"
+ # create_target_group options
+ option :vpc_id, type: :array, desc: "Vpc id"
+ option :target_group_name, desc: "Target group name"
+ # security_group options
+ option :sg_cidr, default: "0.0.0.0/0", desc: "Security group cidr range"
+ def create(name)
+ Create.new(options.merge(name: name)).run
end
- desc "sub SUBCOMMAND", "sub subcommands"
- long_desc Help.text(:sub)
- subcommand "sub", Sub
+ desc "destroy NAME", "Destroy Load Balancer and associated target group."
+ long_desc Help.text(:destroy)
+ def destroy(name)
+ Destroy.new(options.merge(name: name)).run
+ end
+
+ long_desc Help.text(:init)
+ Init.cli_options.each do |args|
+ option *args
+ end
+ register(Init, "init", "init", "Sets up balancer for project")
desc "completion *PARAMS", "Prints words for auto-completion."
long_desc Help.text("completion")
def completion(*params)
Completer.new(CLI, *params).run