Method: MacWifi::CommandLineInterface#run_shell

Defined in:
lib/mac-wifi/command_line_interface.rb

#run_shellObject

Runs a pry session in the context of this object. Commands and options specified on the command line can also be specified in the shell.



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/mac-wifi/command_line_interface.rb', line 163

def run_shell
  begin
    require 'pry'
  rescue LoadError
    puts "The 'pry' gem and/or one of its prerequisites, required for running the shell, was not found." +
             " Please `gem install pry` or, if necessary, `sudo gem install pry`."
    exit(-1)
  end

  print_help

  # Enable the line below if you have any problems with pry configuration being loaded
  # that is messing up this runtime use of pry:
  # Pry.config.should_load_rc = false

  # Strangely, this is the only thing I have found that successfully suppresses the
  # code context output, which is not useful here. Anyway, this will differentiate
  # a pry command from a DSL command, which _is_ useful here.
  Pry.config.command_prefix = '%'

  run_pry
end