I'd like to give some options to magit-grep
running it with option foo
results in
git --no-pager grep -n foo
I'd like to give options to it
git --no-pager grep -n foo (options to include *.html and exclude *.py, etc)
It doesn't have to be magit-grep, what's the best git grep solution in emacs?
magit-grep
(magit-define-command grep (&optional pattern)
(interactive)
(let ((pattern (or pattern
(read-string "git grep: "
(shell-quote-argument (grep-tag-default))))))
(with-current-buffer (generate-new-buffer "*Magit Grep*")
(let ((default-directory (magit-get-top-dir)))
(insert magit-git-executable " "
(mapconcat 'identity magit-git-standard-options " ")
" grep -n "
(shell-quote-argument pattern) "\n\n")
(magit-git-insert (list "grep" "--line-number" pattern))
(grep-mode)
(pop-to-buffer (current-buffer))))))
git grep 'expression' -- '*.html'
should do. Maybe you could extend this function to ask you for the file masks if given universal argument. – Amathist