# File lib/pry/commands/hist.rb, line 22 def options(opt) opt.on :a, :all, "Display all history" opt.on :H, :head, "Display the first N items", :optional_argument => true, :as => Integer opt.on :T, :tail, "Display the last N items", :optional_argument => true, :as => Integer opt.on :s, :show, "Show the given range of lines", :optional_argument => true, :as => Range opt.on :G, :grep, "Show lines matching the given pattern", :argument => true, :as => String opt.on :c, :clear , "Clear the current session's history" opt.on :r, :replay, "Replay a line or range of lines", :argument => true, :as => Range opt.on :save, "Save history to a file", :argument => true, :as => Range opt.on :e, :'exclude-pry', "Exclude Pry commands from the history" opt.on :n, :'no-numbers', "Omit line numbers" end
# File lib/pry/commands/hist.rb, line 35 def process @history = find_history if opts.present?(:show) @history = @history.between(opts[:show]) end if opts.present?(:grep) @history = @history.grep(opts[:grep]) end @history = case when opts.present?(:head) @history.take_lines(1, opts[:head] || 10) when opts.present?(:tail) @history.take_lines(-(opts[:tail] || 10), opts[:tail] || 10) when opts.present?(:show) @history.between(opts[:show]) else @history end if opts.present?(:'exclude-pry') @history = @history.select do |loc| !command_set.valid_command?(loc.line) end end if opts.present?(:save) process_save elsif opts.present?(:clear) process_clear elsif opts.present?(:replay) process_replay else process_display end end