mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-08 14:55:17 +00:00
Add new deletetiddlers command
This commit is contained in:
parent
c80fcf19c0
commit
5b09881679
8
core/language/en-GB/Help/deletetiddlers.tid
Normal file
8
core/language/en-GB/Help/deletetiddlers.tid
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
title: $:/language/Help/deletetiddlers
|
||||||
|
description: Deletes a group of tiddlers
|
||||||
|
|
||||||
|
Deletes a group of tiddlers identified by a filter.
|
||||||
|
|
||||||
|
```
|
||||||
|
--deletetiddlers <filter>
|
||||||
|
```
|
42
core/modules/commands/deletetiddlers.js
Normal file
42
core/modules/commands/deletetiddlers.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/commands/deletetiddlers.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: command
|
||||||
|
|
||||||
|
Command to delete tiddlers
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.info = {
|
||||||
|
name: "deletetiddlers",
|
||||||
|
synchronous: true
|
||||||
|
};
|
||||||
|
|
||||||
|
var Command = function(params,commander,callback) {
|
||||||
|
this.params = params;
|
||||||
|
this.commander = commander;
|
||||||
|
this.callback = callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
Command.prototype.execute = function() {
|
||||||
|
if(this.params.length < 1) {
|
||||||
|
return "Missing filter";
|
||||||
|
}
|
||||||
|
var self = this,
|
||||||
|
wiki = this.commander.wiki,
|
||||||
|
filter = this.params[0],
|
||||||
|
tiddlers = wiki.filterTiddlers(filter);
|
||||||
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
|
wiki.deleteTiddler(title);
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.Command = Command;
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,7 @@
|
|||||||
|
title: DeleteTiddlersCommand
|
||||||
|
tags: Commands
|
||||||
|
created: 20190530155418184
|
||||||
|
modified: 20190530155418184
|
||||||
|
caption: deletetiddlers
|
||||||
|
|
||||||
|
{{$:/language/Help/deletetiddlers}}
|
Loading…
x
Reference in New Issue
Block a user