From 27943c0ea57381d32a29874bf4ae7509440de45a Mon Sep 17 00:00:00 2001 From: Dhananjay Nakrani Date: Sat, 25 Apr 2015 10:03:14 -0700 Subject: [PATCH] Add a './mach grep' command. [Issue #5838] --- python/servo/devenv_commands.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 7caac6e33bd..770c5273397 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -76,3 +76,16 @@ class MachCommands(CommandBase): category='devenv') def rust_root(self): print(self.config["tools"]["rust-root"]) + + @Command('grep', + description='`git grep` for selected directories.', + category='devenv') + @CommandArgument( + 'params', default=None, nargs='...', + help="Command-line arguments to be passed through to `git grep`") + def grep(self, params): + if not params: + params = [] + grep_paths = [path.join(self.context.topdir, 'components'), + path.join(self.context.topdir, 'ports')] + return subprocess.call(["git"] + ["grep"] + params + ['--'] + grep_paths, env=self.build_env())