Class: Appydave::Tools::ZshHistory::Command

Inherits:
Struct
  • Object
show all
Defined in:
lib/appydave/tools/zsh_history/command.rb

Overview

Represents a single command from ZSH history

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



7
8
9
# File 'lib/appydave/tools/zsh_history/command.rb', line 7

def category
  @category
end

#datetimeObject

Returns the value of attribute datetime

Returns:

  • (Object)

    the current value of datetime



7
8
9
# File 'lib/appydave/tools/zsh_history/command.rb', line 7

def datetime
  @datetime
end

#is_multilineObject

Returns the value of attribute is_multiline

Returns:

  • (Object)

    the current value of is_multiline



7
8
9
# File 'lib/appydave/tools/zsh_history/command.rb', line 7

def is_multiline
  @is_multiline
end

#matched_patternObject

Returns the value of attribute matched_pattern

Returns:

  • (Object)

    the current value of matched_pattern



7
8
9
# File 'lib/appydave/tools/zsh_history/command.rb', line 7

def matched_pattern
  @matched_pattern
end

#raw_linesObject

Returns the value of attribute raw_lines

Returns:

  • (Object)

    the current value of raw_lines



7
8
9
# File 'lib/appydave/tools/zsh_history/command.rb', line 7

def raw_lines
  @raw_lines
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



7
8
9
# File 'lib/appydave/tools/zsh_history/command.rb', line 7

def text
  @text
end

#timestampObject

Returns the value of attribute timestamp

Returns:

  • (Object)

    the current value of timestamp



7
8
9
# File 'lib/appydave/tools/zsh_history/command.rb', line 7

def timestamp
  @timestamp
end

Instance Method Details

#formatted_datetime(format = '%Y-%m-%d %H:%M:%S') ⇒ Object



17
18
19
# File 'lib/appydave/tools/zsh_history/command.rb', line 17

def formatted_datetime(format = '%Y-%m-%d %H:%M:%S')
  datetime&.strftime(format) || 'unknown'
end

#to_history_formatObject



21
22
23
24
# File 'lib/appydave/tools/zsh_history/command.rb', line 21

def to_history_format
  # Reconstruct in ZSH history format for writing back
  raw_lines.join("\n")
end