Sha256: f1a76daaf0cc25bcfed1cf8f8d2b06944e26e28adc22b49c9d4a2c94d3875c4a
Contents?: true
Size: 1.01 KB
Versions: 6
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require 'travis/cli' module Travis module CLI class Console < ApiCommand description 'interactive shell; requires `pry`' on '-x', '--eval LINE', 'run line of ruby' do |c, line| c.instance_eval(line) exit end def run ensure_pry Object.send(:include, Client::Namespace.new(session)) hooks = defined?(Pry::Hooks) ? Pry::Hooks.new : {} opts = { quiet: true, output: $stdout, hooks: } opts.merge!({ prompt: }) if prompt binding.pry(opts) end private def ensure_pry require 'pry' rescue LoadError msg = [ 'You need to install pry to use Travis CLI console. Try', nil, '$ (sudo) gem install pry' ].join("\n") error msg end def prompt if Pry.const_defined? :SIMPLE_PROMPT Pry::SIMPLE_PROMPT elsif defined?(Pry::Prompt) Pry::Prompt[:simple] end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems