Sha256: 1f8b2aed1752df2fb019462dad953ca40689cf204c0814a8781b87ea82c087b0

Contents?: true

Size: 1.12 KB

Versions: 20

Compression:

Stored size: 1.12 KB

Contents

require 'cri'
require '3scale_toolbox/base_command'

module ThreeScaleToolbox
  module Commands
    module AccountCommand
      module Find
        class FindSubcommand < Cri::CommandRunner
          include ThreeScaleToolbox::Command

          def self.command
            Cri::Command.define do
              name        'find'
              usage       'find [opts] <remote> <text>'
              summary     'find account'
              description 'Find account by email, provider key or service token'

              option      :a, :'print-all', 'Print all the account info', argument: :forbidden
              param       :remote
              param       :text

              runner FindSubcommand
            end
          end

          def run
            client = threescale_client(arguments[:remote])
            account = ThreeScaleToolbox::Entities::Account.find_by_text(arguments[:text], client)
            if account.nil?
              puts 'Account not found'
              return
            end

            account.verbose = options[:'print-all']
            puts account
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
3scale_toolbox-1.0.1 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-1.0.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.20.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.19.3 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.19.2 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.19.1 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.19.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.18.3 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.18.2 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.18.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.17.1 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.17.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.16.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.15.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.14.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.13.0 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.12.4 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.12.3 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.12.2 lib/3scale_toolbox/commands/account_command/find_command.rb
3scale_toolbox-0.11.0 lib/3scale_toolbox/commands/account_command/find_command.rb