Function: go-test--get-arguments

go-test--get-arguments is a natively compiled function defined in gotest.el.

Signature

(go-test--get-arguments DEFAULTS HISTORY)

Documentation

Get optional arguments for go test or go run.

DEFAULTS will be used when there is no prefix argument. When a prefix argument of '- is given, use the most recent HISTORY item. When single prefix argument is given, prompt for arguments using HISTORY. When double prefix argument is given, run command in compilation buffer with comint-mode enabled. When triple prefix argument is given, prompt for arguments using HISTORY and run command in compilation buffer comint-mode enabled. When a numeric prefix argument is provided, it is used as the -count flag.

Source Code

;; Defined in /nix/store/y8iliarhkh17m4iiwcy1hbi78r7b5489-emacs-packages-deps/share/emacs/site-lisp/elpa/gotest-20230221.945/gotest.el
(defun go-test--get-arguments (defaults history)
  "Get optional arguments for go test or go run.
DEFAULTS will be used when there is no prefix argument.
When a prefix argument of '- is given, use the most recent HISTORY item.
When single prefix argument is given, prompt for arguments using HISTORY.
When double prefix argument is given, run command in compilation buffer with
`comint-mode' enabled.
When triple prefix argument is given, prompt for arguments using HISTORY and
run command in compilation buffer `comint-mode' enabled.
When a numeric prefix argument is provided, it is used as the -count flag."
  (pcase current-prefix-arg
    (`nil defaults)
    ((pred integerp) (s-concat (format "-count=%d " current-prefix-arg) defaults))
    ((or `- `(16)) (car (symbol-value history)))
    ((or `(4) `(64)) (let* ((name (nth 1 (s-split "-" (symbol-name history))))
                            (prompt (s-concat "go " name " args: ")))
                       (read-shell-command prompt defaults history)))))