,@(when namespaced
`((concat "--all-namespaces="
(if kubed-all-namespaces-mode "true" "false"))))
- "--no-headers=true"
(format "--output=custom-columns=%s"
(string-join
(cons "NAME:.metadata.name"
:sentinel (lambda (_proc status)
(cond
((string= status "finished\n")
- (let (new)
+ (let (new offsets eol)
(with-current-buffer ,out-name
(goto-char (point-min))
+ (setq eol (pos-eol))
+ (while (re-search-forward "[^ ]+" eol t)
+ (push (1- (match-beginning 0)) offsets))
+ (setq offsets (nreverse offsets))
+ (forward-char 1)
(while (not (eobp))
- (let ((line (buffer-substring
- (point)
- (progn
- (forward-line 1)
- (1- (point))))))
- (push (split-string line " " t) new))))
+ (let ((cols nil)
+ (beg (car offsets))
+ (ends (cdr offsets)))
+ (dolist (end ends)
+ (push (string-trim (buffer-substring
+ (+ (point) beg)
+ (+ (point) end)))
+ cols)
+ (setq beg end))
+ (push (string-trim (buffer-substring
+ (+ (point) beg)
+ (pos-eol)))
+ cols)
+ (push (nreverse cols) new))
+ (forward-line 1)))
(setq ,list-var new
,proc-var nil)
(run-hooks ',hook-var)