[bug#77884] gnu: trash-cli: Install shell completions.
Commit Message
* gnu/packages/shellutils.scm (trash-cli)[arguments]<#:phases>Install shell completions.
Change-Id: I0b165155d1da8069837bd9b93990dfaf0ff7de52
---
gnu/packages/shellutils.scm | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
base-commit: f7c41ab31f5023023385500f6eb9083d23dd1ccb
@@ -672,7 +672,31 @@ (define-public trash-cli
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
- (invoke "pytest")))))))
+ (invoke "pytest"))))
+ (add-after 'wrap 'install-completions
+ (lambda _
+ (for-each
+ (lambda (binary)
+ (for-each
+ (lambda (shell-completion-data)
+ (mkdir-p
+ (string-append
+ #$output (dirname (cdr shell-completion-data))))
+ (with-output-to-file
+ (format
+ #f (string-append
+ #$output (cdr shell-completion-data))
+ (basename binary))
+ (lambda _
+ (invoke binary "--print-completion"
+ (car shell-completion-data)))))
+ '(("bash" . "/share/bash-completion/completions/~a")
+ ("zsh" . "/share/zsh/site-functions/_~a")
+ ("tcsh" . "/etc/profile.d/~a.completion.csh"))))
+ (find-files
+ (string-append #$output "/bin/")
+ (lambda (file stat)
+ (not (string-suffix? "-real" file))))))))))
(native-inputs (list python-flexmock
python-mock
python-parameterized