Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk
2f34f51c0a070371f30d31939887154c9f00ec46
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: dd9d95ceed12 · Showing diff
- Parent 2: 81a534722677 · Diff against parent 2
bugabingas dorkfiles
2f34f51c0a070371f30d31939887154c9f00ec46
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
+100 / −11 text lines
+100 / −11 text lines
let cache_path = nvim --headless --clean +'lua print(vim.fn.stdpath "cache")' +q | complete | get stderr print 'Installing plugins from puk.plugins.nuon.'# check online for fresh commits. Does not actually mutate or update anything.# updated plugin specs will be written to a new file.def 'main update' [] { let plugin_specs = open puk.plugins.nuon let updated = $plugin_specs | update commit { |spec| let fresh_commit = find-latest-commit $spec if ($fresh_commit != $spec.commit) { print $"Found fresh commit for ($spec.name):($fresh_commit)!" return $fresh_commit } return $spec.commit } if not ($plugin_specs == $updated) { $plugin_specs | merge $updated | to nuon --indent 2 | save --force puk.plugins.updated.nuon print "Written updated puk.plugins into puk.plugins.updated.nuon!" } else { print "Nothing to do." }}# deletes all existing plugins, that are NOT in the specs!def clean-plugins [ plugins_path: path # folder to install plugins into plugin_specs: list<any> # all known plugins] { ls $plugins_path | each { | row | let existing_plugin_name = $row.name | path basename if ( $plugin_specs | where name == $existing_plugin_name | is-empty) { print $"Found plugin, that is not part of the specs: ($existing_plugin_name)" rm --interactive --trash --recursive $row.name } }} $commit == $spec.commit return ($commit == $spec.commit)}def find-latest-commit [ spec: record # a plugin to install] { let feed = generate-commit-feed-url $spec let commit = match $spec.source { github => { http get $feed | lines | parse --regex "Commit/(?<commit>[a-z0-9]+)" | first | get commit }, codeberg => { 'TODO' }, srht => { 'TODO' }, _ => { error make { msg: 'unknown plugin source given' label: { text: 'dunno this one' span: (metadata $spec.source).span } } } } $commit}def generate-commit-feed-url [ spec: record # a plugin to install] { let url_format = match $spec.source { github => { 'https://github.com/{repo}/commits/{branch}.atom' }, codeberg => { 'TODO' }, srht => { 'TODO' }, _ => { error make { msg: 'unknown plugin source given' label: { text: 'dunno this one' span: (metadata $spec.source).span } } } } $spec | format pattern $url_format print $"($spec.name) already cached in ($archive_path)"let allowed_shared_lib_type = match ( sys host | get name ) { $name if $name =~ 'Windows' => { 'dll' }, $name if $name =~ 'Linux' => { 'so' }, $name if $name =~ 'Mac' => { 'dylib' }, _ => { error make { msg: 'unknown operating system' } },}let allowed_filetypes = [ lua vim scm txt $allowed_shared_lib_type ] print $"Downloading ($spec.name)..." print $"Unpacking ($spec.name)..." print $"Installing ($spec.name)..."