Sha256: 2d8e260c7733c3e08cb224a07d172c39575c35bfcaf58545df37d5ab7c4620c2

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

require "shelly/cli/main"

module Shelly
  module CLI
    class Runner < Thor::Shell::Basic
      include Helpers
      attr_accessor :args

      def initialize(args = [])
        super()
        @args = args
      end

      def debug?
        args.include?("--debug") || ENV['SHELLY_DEBUG'] == "true"
      end

      def start
        Shelly::CLI::Main.start(args)
      rescue SystemExit; raise
      rescue Client::UnauthorizedException
        raise if debug?
        say_error "You are not logged in. To log in use: `shelly login`"
      rescue Client::GemVersionException => e
        raise if debug?
        say "Required shelly gem version: #{e.body["required_version"]}"
        say "Your version: #{VERSION}"
        say_error "Update shelly gem with `gem install shelly`"
      rescue Interrupt
        raise if debug?
        say_new_line
        say_error "[canceled]"
      rescue Exception
        raise if debug?
        say_error "Unknown error, to see debug information run command with --debug"
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
shelly-0.0.60 lib/shelly/cli/runner.rb
shelly-0.0.59 lib/shelly/cli/runner.rb
shelly-0.0.58 lib/shelly/cli/runner.rb
shelly-0.0.57 lib/shelly/cli/runner.rb
shelly-0.0.56 lib/shelly/cli/runner.rb
shelly-0.0.55 lib/shelly/cli/runner.rb
shelly-0.0.55.pre lib/shelly/cli/runner.rb
shelly-0.0.54 lib/shelly/cli/runner.rb
shelly-0.0.53 lib/shelly/cli/runner.rb
shelly-0.0.52 lib/shelly/cli/runner.rb
shelly-0.0.51.pre lib/shelly/cli/runner.rb
shelly-0.0.51 lib/shelly/cli/runner.rb
shelly-0.0.50.pre2 lib/shelly/cli/runner.rb
shelly-0.0.50.pre lib/shelly/cli/runner.rb
shelly-0.0.50 lib/shelly/cli/runner.rb