Class: Zephira::Commands::Clear

Inherits:
Object
  • Object
show all
Defined in:
lib/zephira/commands/clear.rb

Constant Summary collapse

USAGE =
"Usage: /clear [session|all]"

Class Method Summary collapse

Class Method Details

.descriptionObject



13
14
15
# File 'lib/zephira/commands/clear.rb', line 13

def description
  "Clear history: 'session' clears current session, 'all' clears everything"
end

.nameObject



9
10
11
# File 'lib/zephira/commands/clear.rb', line 9

def name
  "clear"
end

.run(agent:, args:) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/zephira/commands/clear.rb', line 17

def run(agent:, args:)
  case args&.first
  when "session"
    agent.history.clear_session
    puts "Session history cleared."
  when "all"
    agent.history.clear
    puts "History cleared."
  else
    puts USAGE
  end
end