From 2abe149c23c7588501bb001a7dd58505585b80b5 Mon Sep 17 00:00:00 2001 From: Gabriel Braga Date: Thu, 13 Jun 2024 09:29:21 +0200 Subject: [PATCH] Review changes on the grep_pipe function Just renaming and unification with the grep command. --- aexpect/ops_linux.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aexpect/ops_linux.py b/aexpect/ops_linux.py index bb138ac..a1974f3 100644 --- a/aexpect/ops_linux.py +++ b/aexpect/ops_linux.py @@ -432,22 +432,22 @@ def grep(session, expr, path, check=False, flags="-a"): return output -def grep_pipe(session, cmd, pattern, flags = "", check = False): +def grep_pipe(session, cmd, expr, check = False, flags ="-a"): """ Invoke ``grep`` remotely searching for an expression in a command output. - :param session: vm session + :param session: session to run the command on :type session: ShellSession - :param str cmd: command that its output will be grepped - :param str pattern: pattern to grep - :param str flags: extra flags passed to ``grep`` on the command line + :param str cmd: command whose output will be grepped + :param str expr: search expression :param bool check: whether to quietly run grep for a boolean check + :param str flags: extra flags passed to ``grep`` on the command line :returns: whether there is a match or not or what ``grep`` emits on stdout if the check mode is disabled :rtype: bool or str :raises: ShellCmdError if the check mode is disabled and status is nonzero """ - grep_command = f"{cmd} | grep {flags} '{pattern}'" + grep_command = f"{cmd} | grep {flags} '{expr}'" status, output = session.cmd_status_output(grep_command) if check: return status == 0