I'm trying to implement a simple helm extension for work which among other things provides an action to "grep across selected log file candidates". I've got this all working for actions like this:
(defun visit-logs-action (log-directory log-name)
"Visit the selected log files"
(let ((full-paths (mapcar (lambda (fn) (concat log-directory "/" fname))
(helm-marked-candidates))))
(mapc #'find-file full-paths)))
(in the above I pass log-directory
myself from a lambda and helm gives me log-name
but I ignore it to instead consider all selected candidates (based on reading handling multiple selections)
I'm having trouble with a "grep across selected log files" primarily because they are xz
compressed. I tried looking at the occur
family of functions or even helm-swoop
but those go off buffers. The closest I've come so far is with helm-ag
by doing something like this:
(defun grep-logs-action (log-directory log-name)
"Any swoop/helm-ag/occur over the files would be great here."
(let ((helm-ag-command-option "-z"))
(helm-do-ag log-directory (helm-marked-candidates))))
but the output of that looks corrupt. Haven't found a good hook either for this in helm-grep
I also tried to find a way to use helm-rg
but so far that does not seem to accept a list of paths and instead only a directory (and that works poorly because the log directory is huge with too many large logs). Am wondering if there are other simple alternatives that I could try here to hop into a swoop/grep/occur really anything to fulfill that extra functionality