I want to highlight a complete terminal flow, mostly for the Cisco CLI, but Bash would be nice, too. As for now, the result achieved with the package lstlisting looks as follows:
I achieved that with the following code:
\lstdefinestyle{default}{
backgroundcolor=\color{background},
basicstyle=\ttfamily\small,
breakatwhitespace=true,
breaklines=true,
commentstyle=\color{comments},
deletekeywords={},
escapeinside={}{},
extendedchars=true,
frame=lines,
keepspaces=true,
keywordstyle=\color{keywords},
morekeywords={},
numbers=left,
numberstyle=\color{numbers},
rulecolor=\color{numbers},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
stringstyle=\color{strings},
tabsize=2,
title=\filename{\lstname}
}
\lstset{
style=default,
}
\lstdefinelanguage{cisco-terminal}{
basicstyle=\ttfamily\footnotesize\color{keywords},
morecomment=[l][\color{black}]{\#},
morecomment=[l][\color{black}]{>},
morecomment=[s][\color{strings}]{*}{'},
morecomment=[s][\color{strings}]{`}{'},
numbers=none
}
The problem I have, is that the output of certain commands (do sh run) can only be highlighted when I surround them with ` and '. If I do not, certain snippets may look like this:

Does anybody have an idea how to achieve the upper result in a better way (without the ` and ')? Are there any packages for this use case out there?
The test code can be found here: https://pastebin.com/ZSFb6ymi
A fully compileable example with and without workaround can be found here: https://pastebin.com/qRGfgkPj
Thank you in advance!
