Sha256: fcc71da87241317da811e24e0f9d61baec5a7c2385ed25d00293b3e97256caef

Contents?: true

Size: 1.09 KB

Versions: 25

Compression:

Stored size: 1.09 KB

Contents

require "shelly/cli/command"

module Shelly
  module CLI
    class Organization < Command
      namespace :organization
      include Helpers

      before_hook :logged_in?, :only => [:list, :add]

      desc "list", "Lists organizations"
      def list
        user = Shelly::User.new
        organizations = user.organizations
        say "You have access to the following organizations and clouds:", :green
        say_new_line
        organizations.each do |organization|
          say organization.name, :green
          if organization.apps.present?
            print_table(apps_table(organization.apps), :ident => 2, :colwidth => 35)
          else
            print_wrapped "No clouds", :ident => 2
          end
        end
      end

      method_option "redeem-code", :type => :string, :aliases => "-r",
        :desc => "Redeem code for free credits"
      desc "add", "Add a new organization"
      def add
        create_new_organization(options)
      rescue Client::ValidationException => e
        e.each_error { |error| say_error error, :with_exit => false }
        exit 1
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
shelly-0.4.24 lib/shelly/cli/organization.rb
shelly-0.4.23 lib/shelly/cli/organization.rb
shelly-0.4.23.pre lib/shelly/cli/organization.rb
shelly-0.4.22 lib/shelly/cli/organization.rb
shelly-0.4.21 lib/shelly/cli/organization.rb
shelly-0.4.19 lib/shelly/cli/organization.rb
shelly-0.4.18 lib/shelly/cli/organization.rb
shelly-0.4.17 lib/shelly/cli/organization.rb
shelly-0.4.16 lib/shelly/cli/organization.rb
shelly-0.4.15 lib/shelly/cli/organization.rb
shelly-0.4.14 lib/shelly/cli/organization.rb
shelly-0.4.13 lib/shelly/cli/organization.rb
shelly-0.4.12 lib/shelly/cli/organization.rb
shelly-0.4.11 lib/shelly/cli/organization.rb
shelly-0.4.10 lib/shelly/cli/organization.rb
shelly-0.4.9 lib/shelly/cli/organization.rb
shelly-0.4.8 lib/shelly/cli/organization.rb
shelly-0.4.7 lib/shelly/cli/organization.rb
shelly-0.4.6 lib/shelly/cli/organization.rb
shelly-0.4.5 lib/shelly/cli/organization.rb