1 line
7.6 KiB
JSON
1 line
7.6 KiB
JSON
{"name":"git","imports":["https://get.silverbullet.md/global.plug.json"],"requiredPermissions":["shell"],"functions":{"snapshotCommand":{"env":"client","command":{"name":"Git: Snapshot"},"code":"(() => { var mod=(()=>{var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var m=(e,r)=>{for(var o in r)l(e,o,{get:r[o],enumerable:!0})},x=(e,r,o,n)=>{if(r&&typeof r==\"object\"||typeof r==\"function\")for(let s of f(r))!d.call(e,s)&&s!==o&&l(e,s,{get:()=>r[s],enumerable:!(n=p(r,s))||n.enumerable});return e};var P=e=>x(l({},\"__esModule\",{value:!0}),e);var re={};m(re,{default:()=>te});var i=self.syscall;typeof self>\"u\"&&(self={syscall:()=>{throw new Error(\"Not implemented here\")}});var t=self.syscall;var a={};m(a,{dispatch:()=>$,enableReadOnlyMode:()=>H,filterBox:()=>U,flashNotification:()=>R,getCurrentPage:()=>M,getCursor:()=>k,getSelection:()=>T,getText:()=>C,hidePanel:()=>I,insertAtCursor:()=>Q,insertAtPos:()=>O,matchBefore:()=>G,moveCursor:()=>V,navigate:()=>E,openUrl:()=>N,prompt:()=>z,reloadPage:()=>q,replaceRange:()=>K,save:()=>L,setPage:()=>S,setSelection:()=>D,showPanel:()=>B});function M(){return t(\"editor.getCurrentPage\")}function S(e){return t(\"editor.setPage\",e)}function C(){return t(\"editor.getText\")}function k(){return t(\"editor.getCursor\")}function T(){return t(\"editor.getSelection\")}function D(e,r){return t(\"editor.setSelection\",e,r)}function L(){return t(\"editor.save\")}function E(e,r,o=!1){return t(\"editor.navigate\",e,r,o)}function q(){return t(\"editor.reloadPage\")}function N(e){return t(\"editor.openUrl\",e)}function R(e,r=\"info\"){return t(\"editor.flashNotification\",e,r)}function U(e,r,o=\"\",n=\"\"){return t(\"editor.filterBox\",e,r,o,n)}function B(e,r,o,n=\"\"){return t(\"editor.showPanel\",e,r,o,n)}function I(e){return t(\"editor.hidePanel\",e)}function O(e,r){return t(\"editor.insertAtPos\",e,r)}function K(e,r,o){return t(\"editor.replaceRange\",e,r,o)}function V(e){return t(\"editor.moveCursor\",e)}function Q(e){return t(\"editor.insertAtCursor\",e)}function G(e){return t(\"editor.matchBefore\",e)}function $(e){return t(\"editor.dispatch\",e)}function z(e,r=\"\"){return t(\"editor.prompt\",e,r)}function H(e){return t(\"editor.enableReadOnlyMode\",e)}var u={};m(u,{invokeCommand:()=>_,invokeFunction:()=>Z,listCommands:()=>j,reloadPlugs:()=>ee});function Z(e,r,...o){return t(\"system.invokeFunction\",e,r,...o)}function _(e){return t(\"system.invokeCommand\",e)}function j(){return t(\"system.listCommands\")}function ee(){t(\"system.reloadPlugs\")}async function g(){let e=await a.prompt(\"Revision name:\");e||(e=\"Snapshot\"),console.log(\"Revision name\",e),await u.invokeFunction(\"server\",\"commit\",e)}var te=g;return P(re);})();\n return mod;})()"},"syncCommand":{"env":"client","command":{"name":"Git: Sync"},"code":"(() => { var mod=(()=>{var l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var m=(e,r)=>{for(var o in r)l(e,o,{get:r[o],enumerable:!0})},x=(e,r,o,n)=>{if(r&&typeof r==\"object\"||typeof r==\"function\")for(let s of p(r))!d.call(e,s)&&s!==o&&l(e,s,{get:()=>r[s],enumerable:!(n=f(r,s))||n.enumerable});return e};var P=e=>x(l({},\"__esModule\",{value:!0}),e);var re={};m(re,{default:()=>te});var i=self.syscall;typeof self>\"u\"&&(self={syscall:()=>{throw new Error(\"Not implemented here\")}});var t=self.syscall;var a={};m(a,{dispatch:()=>$,enableReadOnlyMode:()=>H,filterBox:()=>U,flashNotification:()=>R,getCurrentPage:()=>M,getCursor:()=>k,getSelection:()=>T,getText:()=>C,hidePanel:()=>I,insertAtCursor:()=>Q,insertAtPos:()=>O,matchBefore:()=>G,moveCursor:()=>V,navigate:()=>E,openUrl:()=>N,prompt:()=>z,reloadPage:()=>q,replaceRange:()=>K,save:()=>L,setPage:()=>S,setSelection:()=>D,showPanel:()=>B});function M(){return t(\"editor.getCurrentPage\")}function S(e){return t(\"editor.setPage\",e)}function C(){return t(\"editor.getText\")}function k(){return t(\"editor.getCursor\")}function T(){return t(\"editor.getSelection\")}function D(e,r){return t(\"editor.setSelection\",e,r)}function L(){return t(\"editor.save\")}function E(e,r,o=!1){return t(\"editor.navigate\",e,r,o)}function q(){return t(\"editor.reloadPage\")}function N(e){return t(\"editor.openUrl\",e)}function R(e,r=\"info\"){return t(\"editor.flashNotification\",e,r)}function U(e,r,o=\"\",n=\"\"){return t(\"editor.filterBox\",e,r,o,n)}function B(e,r,o,n=\"\"){return t(\"editor.showPanel\",e,r,o,n)}function I(e){return t(\"editor.hidePanel\",e)}function O(e,r){return t(\"editor.insertAtPos\",e,r)}function K(e,r,o){return t(\"editor.replaceRange\",e,r,o)}function V(e){return t(\"editor.moveCursor\",e)}function Q(e){return t(\"editor.insertAtCursor\",e)}function G(e){return t(\"editor.matchBefore\",e)}function $(e){return t(\"editor.dispatch\",e)}function z(e,r=\"\"){return t(\"editor.prompt\",e,r)}function H(e){return t(\"editor.enableReadOnlyMode\",e)}var u={};m(u,{invokeCommand:()=>_,invokeFunction:()=>Z,listCommands:()=>j,reloadPlugs:()=>ee});function Z(e,r,...o){return t(\"system.invokeFunction\",e,r,...o)}function _(e){return t(\"system.invokeCommand\",e)}function j(){return t(\"system.listCommands\")}function ee(){t(\"system.reloadPlugs\")}async function g(){await a.flashNotification(\"Syncing with git\"),await u.invokeFunction(\"server\",\"sync\"),await a.flashNotification(\"Git sync complete!\")}var te=g;return P(re);})();\n return mod;})()"},"commit":{"env":"server","code":"(() => { var mod=(()=>{var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,t)=>{for(var s in t)a(e,s,{get:t[s],enumerable:!0})},x=(e,t,s,u)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let n of p(t))!d.call(e,n)&&n!==s&&a(e,n,{get:()=>t[n],enumerable:!(u=f(t,n))||u.enumerable});return e};var P=e=>x(a({},\"__esModule\",{value:!0}),e);var L={};l(L,{default:()=>D});var r=self.syscall;var i={};l(i,{run:()=>F});function F(e,t){return r(\"shell.run\",e,t)}typeof self>\"u\"&&(self={syscall:()=>{throw new Error(\"Not implemented here\")}});var o=self.syscall;async function g(e){e||(e=\"Snapshot\"),console.log(\"Snapshotting the current space to git with commit message\",e),await i.run(\"git\",[\"add\",\"./*.md\"]);try{await i.run(\"git\",[\"commit\",\"-a\",\"-m\",e])}catch{}console.log(\"Done!\")}var D=g;return P(L);})();\n return mod;})()"},"sync":{"env":"server","code":"(() => { var mod=(()=>{var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,t)=>{for(var s in t)a(e,s,{get:t[s],enumerable:!0})},x=(e,t,s,u)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let i of p(t))!d.call(e,i)&&i!==s&&a(e,i,{get:()=>t[i],enumerable:!(u=f(t,i))||u.enumerable});return e};var P=e=>x(a({},\"__esModule\",{value:!0}),e);var E={};l(E,{default:()=>L});var r=self.syscall;var o={};l(o,{run:()=>F});function F(e,t){return r(\"shell.run\",e,t)}typeof self>\"u\"&&(self={syscall:()=>{throw new Error(\"Not implemented here\")}});var n=self.syscall;async function D(e){e||(e=\"Snapshot\"),console.log(\"Snapshotting the current space to git with commit message\",e),await o.run(\"git\",[\"add\",\"./*.md\"]);try{await o.run(\"git\",[\"commit\",\"-a\",\"-m\",e])}catch{}console.log(\"Done!\")}async function g(){console.log(\"Going to sync with git\"),await D(),console.log(\"Then pulling from remote\"),await o.run(\"git\",[\"pull\"]),console.log(\"And then pushing to remote\"),await o.run(\"git\",[\"push\"]),console.log(\"Done!\")}var L=g;return P(E);})();\n return mod;})()"}},"assets":{}} |