Sha256: 3daf2f44d09722d0bfaacd0cb06183ffff235e87ddc9e5ec9ffdf241a48b3394

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

module Pcli
  module Services
    module Steps
      class Connect < Step
        include Depends.on(
          'config.endpoint',
          'api',
          'output',
          'screen'
        )

        spaced

        def run(_prev)
          spinner = SimpleSpinnerBar.start("Connecting to #{endpoint}", output)

          response = api.info

          if response.success?
            v = response.json['version']
            spinner.success("#{Pl.green('Connected')} to #{endpoint}, #{Pl.yellow("v#{v}")}")
            success
          else
            spinner.failure
            output.puts
            Output::ServerError.show(response, output, screen)
            failure
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pcli-0.1.1 lib/pcli/services/steps/connect.rb
pcli-0.1.0 lib/pcli/services/steps/connect.rb