From 066e553f8422aa22af2307d2db365f685f87c9d1 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 23 Feb 2024 12:51:29 +0000 Subject: [PATCH] Introduce command to load tiddler folders into a bag --- .../modules/command-mws-load-tiddlers.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 plugins/tiddlywiki/multiwikiserver/modules/command-mws-load-tiddlers.js diff --git a/plugins/tiddlywiki/multiwikiserver/modules/command-mws-load-tiddlers.js b/plugins/tiddlywiki/multiwikiserver/modules/command-mws-load-tiddlers.js new file mode 100644 index 000000000..51e239995 --- /dev/null +++ b/plugins/tiddlywiki/multiwikiserver/modules/command-mws-load-tiddlers.js @@ -0,0 +1,40 @@ +/*\ +title: $:/plugins/tiddlywiki/multiwikiserver/mws-load-tiddlers.js +type: application/javascript +module-type: command + +Command to recursively load a directory of tiddler files into a bag + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports.info = { + name: "mws-load-tiddlers", + synchronous: true +}; + +var Command = function(params,commander,callback) { + this.params = params; + this.commander = commander; + this.callback = callback; +}; + +Command.prototype.execute = function() { + var self = this; + // Check parameters + if(this.params.length < 2) { + return "Missing pathname and/or bagname"; + } + var tiddlersPath = this.params[0], + bagName = this.params[1]; + $tw.mws.store.saveTiddlersFromPath(tiddlersPath,bagName); + return null; +}; + +exports.Command = Command; + +})();