\documentclass[12pt]{article}

\usepackage{listings,xcolor}
\makeatletter
\newcommand\showcmd{%
    \leavevmode\bgroup %
      \def\lst@boxpos{b}%
      \lsthk@PreSet\lstset{flexiblecolumns,basicstyle=\ttfamily\color{red}}%
      \lsthk@TextStyle
      \@ifnextchar\bgroup{\afterassignment\lst@InlineG \let\@let@token}%
                         \lstinline@}
\makeatother
\begin{document}

foo \showcmd|bar| baz

\end{document}