gli: `binding.pry` does not work after including GLI

#!/usr/bin/env ruby
require 'gli'
require 'pry'
include GLI::App
binding.pry

Gives error:

before_session hook failed: NoMethodError: undefined method process_line' for #<Hash:0x007faf1b22e0d0> /usr/local/var/rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:448:inrun_command’

Versions

ruby : 2.1.1p76 pry : 0.10.1 gli: 2.12.2

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 22 (9 by maintainers)

Commits related to this issue

Most upvoted comments

So this fixes it:

module Wrapper
  include GLI::App

  extend self
  program_desc "..."
  ...

  exit run ARGV
end

This boxes the CLI into a wrapper class and lets pry load normally.

The scaffold no longer makes apps with GLI in the global namespace, so closing (I think #278 fixed this so thanks @dblock!)

If it works, then “no” 😃

Dave

On Sun, Jan 1, 2017 at 10:33 PM, Max Bigras notifications@github.com wrote:

@davetron5000 https://github.com/davetron5000 that makes sense.

Is there anyone downside to wrapping the include GLI::App inside a module so pry can work though?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davetron5000/gli/issues/196#issuecomment-269932035, or mute the thread https://github.com/notifications/unsubscribe-auth/AABXCogrRpA79EmhQhkFBDOseku-ZGFvks5rOG_zgaJpZM4CqCCs .