12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- (require 'guix-help-vars)
- (require 'guix-read)
- (require 'guix-repl)
- (require 'guix-guile)
- (require 'guix-utils)
- (define-obsolete-variable-alias 'guix-hash-support-dired
- 'guix-support-dired "0.4.1")
- (defun guix-hash (file &optional format)
- "Calculate and copy (put into `kill-ring') the hash of FILE.
- If FILE is a directory, calculate its hash recursively excluding
- version-controlled files.
- Interactively, prompt for FILE (see also `guix-support-dired').
- With prefix argument, prompt for FORMAT as well.
- See also Info node `(guix) Invoking guix hash'."
- (interactive
- (list (guix-read-file-name-maybe)
- (and current-prefix-arg
- (guix-read-hash-format))))
- (let* ((file (guix-file-name file))
- (args (list :format (or format guix-default-hash-format)))
- (args (if (file-directory-p file)
- (append '(:recursive? t) args)
- args))
- (hash (guix-eval-read
- (apply #'guix-make-guile-expression
- 'file-hash file args))))
- (kill-new hash)
- (message "Hash of \"%s\" (%s) has been added to the kill ring."
- (file-name-nondirectory file)
- hash)))
- (provide 'guix-hash)
|