aboutsummaryrefslogtreecommitdiffstats
path: root/bundle/macports-checksums/autoload
diff options
context:
space:
mode:
authorTeddy Wing2022-05-26 18:46:20 +0200
committerTeddy Wing2022-05-26 18:46:20 +0200
commit370a12d7df3c7e2d0f7a08a66c9c9f09b85870c9 (patch)
treeb66d5542bad231be8b16444274c99106aa0e9e63 /bundle/macports-checksums/autoload
parent110106795b8d77e27ebd9799cd7b886d78599aac (diff)
downloaddotvim-370a12d7df3c7e2d0f7a08a66c9c9f09b85870c9.tar.bz2
Add 'macports-checksums' plugin
A new command that appends MacPorts checksums for a given file.
Diffstat (limited to 'bundle/macports-checksums/autoload')
-rw-r--r--bundle/macports-checksums/autoload/macports_checksums.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/bundle/macports-checksums/autoload/macports_checksums.vim b/bundle/macports-checksums/autoload/macports_checksums.vim
new file mode 100644
index 0000000..b01e65d
--- /dev/null
+++ b/bundle/macports-checksums/autoload/macports_checksums.vim
@@ -0,0 +1,19 @@
+" Append MacPorts checksums for `a:file` to the current line.
+function! macports_checksums#Checksums(file)
+ let rmd160 = system('openssl dgst -rmd160 ' . fnameescape(a:file))[:-2]
+ let sha256 = system('shasum -a 256 ' . fnameescape(a:file))
+ let filesize = system('wc -c ' . fnameescape(a:file))
+
+ call append(
+ \ '.',
+ \ ' size ' . split(filesize, ' ')[0]
+ \ )
+ call append(
+ \ '.',
+ \ ' sha256 ' . split(sha256, ' ')[0] . ' \'
+ \ )
+ call append(
+ \ '.',
+ \ 'checksums rmd160 ' . split(rmd160, ' ')[1] . ' \'
+ \ )
+endfunction