Class: Mysh::HistoryCommand

Inherits:
Action show all
Defined in:
lib/mysh/internal/history.rb

Overview

The mysh internal history command.

Instance Attribute Summary

Attributes inherited from Action

#description, #name

Instance Method Summary collapse

Methods inherited from Action

#action_info, #process_quick_command, #short_name

Constructor Details

#initialize(*args) ⇒ HistoryCommand

Set up this command.



10
11
12
13
# File 'lib/mysh/internal/history.rb', line 10

def initialize(*args)
  super
  @args = @history = nil
end

Instance Method Details

#process_command(input) ⇒ Object

Execute the history command.



16
17
18
19
20
21
22
23
# File 'lib/mysh/internal/history.rb', line 16

def process_command(input)
  @args, @history = input.args, Mysh.input.history

  # The history command should not be part of the history.
  @history.pop

  pull_index || clear_history || show_history
end