def process
@history = Pry::Code(Pry.history.to_a)
@history = case
when opts.present?(:head)
@history.between(1, opts[:head] || 10)
when opts.present?(:tail)
@history.between(-(opts[:tail] || 10), -1)
when opts.present?(:show)
@history.between(opts[:show])
else
@history
end
if opts.present?(:grep)
@history = @history.grep(opts[:grep])
end
if opts.present?('exclude-pry''exclude-pry')
@history = @history.select { |l, ln| !command_set.valid_command?(l) }
end
if opts.present?(:save)
process_save
elsif opts.present?(:clear)
process_clear
elsif opts.present?(:replay)
process_replay
else
process_display
end
end