1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-19 08:45:13 +00:00

New commands

This commit is contained in:
Jeremy Ruston
2024-07-05 18:40:59 +01:00
parent d1edf6424d
commit f1d0e52ff7
9 changed files with 333 additions and 141 deletions

View File

@@ -0,0 +1,47 @@
/*\
title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-create-bag.js
type: application/javascript
module-type: command
Command to load archive of recipes, bags and tiddlers from a directory
--mws-create-bag <name> <description>
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.info = {
name: "mws-create-bag",
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 < 1) {
return "Missing bag name";
}
var bagName = this.params[0],
bagDescription = this.params[1] || bagName;
// Create bag
var result = $tw.mws.store.createBag(bagName,bagDescription);
if(result) {
return result.message;
} else {
return null;
}
};
exports.Command = Command;
})();