Sha256: 26a6d29ec8d31679e8dea54ff4dc69c32a1f4747f9198e2fc64e0a602b06c7cf

Contents?: true

Size: 476 Bytes

Versions: 2

Compression:

Stored size: 476 Bytes

Contents

module Pcli
  module Services
    module Commands
      class Login < Dry::CLI::Command
        include Depends.on('authenticate', 'api', 'prompt', 'output')

        desc 'Log in.'

        def call(*)
          if api.token && !prompt.yes?('You are already logged in. Would you like to log out?')
            output.puts('Aborted.')
            return
          end

          authenticate.run(true)

          CommandOutput.continue
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pcli-0.1.1 lib/pcli/services/commands/login.rb
pcli-0.1.0 lib/pcli/services/commands/login.rb