maint: Refactor Key Value Output Parsers

This extracts parsing the output of a command to a common method shared between
powershellparser, textparser and scriptparser and cleans up the methods to take
advantage of the same parsing technique.