Introduce command to load tiddler folders into a bag

This commit is contained in:
Jeremy Ruston 2024-02-23 12:51:29 +00:00
parent 61b54125be
commit 066e553f84
1 changed files with 40 additions and 0 deletions

View File

@ -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;
})();