Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion splunklib/searchcommands/search_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,19 @@ def _process_protocol_v1(self, argv, ifile, ofile):

debug('%s.process finished under protocol_version=1', class_name)

def _protocol_v2_option_parser(self, arg):
""" Determines if an argument is an Option/Value pair, or just a Positional Argument.
Method so different search commands can handle parsing of arguments differently.

:param arg: A single argument provided to the command from SPL
:type arg: str

:return: [OptionName, OptionValue] OR [PositionalArgument]
:rtype: List[str]

"""
return arg.split('=', 1)

def _process_protocol_v2(self, argv, ifile, ofile):
""" Processes records on the `input stream optionally writing records to the output stream.

Expand Down Expand Up @@ -704,7 +717,7 @@ def _process_protocol_v2(self, argv, ifile, ofile):

if args and type(args) == list:
for arg in args:
result = arg.split('=', 1)
result = self._protocol_v2_option_parser(arg)
if len(result) == 1:
self.fieldnames.append(str(result[0]))
else:
Expand Down