grepros 1.2.2
grep for ROS bag files and live topics
Loading...
Searching...
No Matches
TextSinkMixin Class Reference

Provides message formatting as text. More...

Inheritance diagram for TextSinkMixin:
Inheritance graph

Public Member Functions

 __init__ (self, args=None, **kwargs)
 
 format_message (self, msg, highlight=False)
 Returns message as formatted string, optionally highlighted for matches if configured.
 
 message_to_yaml (self, val, top=(), typename=None)
 Returns ROS message or other value as YAML.
 
 validate (self)
 Returns whether arguments are valid, emits error if not, else populates options.
 

Static Public Attributes

 DEFAULT_ARGS
 Constructor argument defaults.
 
str NOCOLOR_HIGHLIGHT_WRAPPERS = "**", "**"
 Default highlight wrappers if not color output.
 

Detailed Description

Provides message formatting as text.

Definition at line 137 of file outputs.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  args = None,
**  kwargs 
)
Parameters
argsarguments as namespace or dictionary, case-insensitive
args.colorFalse or "never" for not using colors in replacements
args.highlighthighlight matched values (default true)
args.emit_fieldmessage fields to emit if not all
args.noemit_fieldmessage fields to skip in output
args.max_field_linesmaximum number of lines to output per field
args.start_linemessage line number to start output from
args.end_linemessage line number to stop output at
args.max_message_linesmaximum number of lines to output per message
args.lines_around_matchnumber of message lines around matched fields to output
args.matched_fields_onlyoutput only the fields where match was found
args.wrap_widthcharacter width to wrap message YAML output at
args.match_wrapperstring to wrap around matched values, both sides if one value, start and end if more than one, or no wrapping if zero values
kwargsany and all arguments as keyword overrides, case-insensitive

Reimplemented in ConsoleSink, and HtmlSink.

Definition at line 168 of file outputs.py.

Member Function Documentation

◆ format_message()

format_message (   self,
  msg,
  highlight = False 
)

Returns message as formatted string, optionally highlighted for matches if configured.

Reimplemented in HtmlSink.

Definition at line 185 of file outputs.py.

◆ message_to_yaml()

message_to_yaml (   self,
  val,
  top = (),
  typename = None 
)

Returns ROS message or other value as YAML.

Definition at line 226 of file outputs.py.

◆ validate()

validate (   self)

Returns whether arguments are valid, emits error if not, else populates options.

Reimplemented in ConsoleSink, and HtmlSink.

Definition at line 176 of file outputs.py.

Member Data Documentation

◆ DEFAULT_ARGS

DEFAULT_ARGS
static
Initial value:
= dict(COLOR=True, EMIT_FIELD=(), NOEMIT_FIELD=(), HIGHLIGHT=True,
MAX_FIELD_LINES=None, START_LINE=None, END_LINE=None,
MAX_MESSAGE_LINES=None, LINES_AROUND_MATCH=None, MATCHED_FIELDS_ONLY=False,
WRAP_WIDTH=None, MATCH_WRAPPER=None)

Constructor argument defaults.

Definition at line 144 of file outputs.py.

◆ NOCOLOR_HIGHLIGHT_WRAPPERS

str NOCOLOR_HIGHLIGHT_WRAPPERS = "**", "**"
static

Default highlight wrappers if not color output.

Definition at line 141 of file outputs.py.


The documentation for this class was generated from the following file: