From 12630d4a91b4cc7b1eb846c3afbeda16858df05a Mon Sep 17 00:00:00 2001 From: Jermolene Date: Fri, 8 Mar 2019 16:43:04 +0000 Subject: [PATCH] Provide an option for the load command to not error if no tiddlers are found --- core/language/en-GB/Help/load.tid | 6 ++++-- core/modules/commands/load.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/language/en-GB/Help/load.tid b/core/language/en-GB/Help/load.tid index afc8642cb..2999f60c5 100644 --- a/core/language/en-GB/Help/load.tid +++ b/core/language/en-GB/Help/load.tid @@ -4,10 +4,12 @@ description: Load tiddlers from a file Load tiddlers from TiddlyWiki (`.html`), `.tiddler`, `.tid`, `.json` or other local files. The processing applied to incoming files is determined by the file extension. Use the alternative `import` command if you need to specify the deserializer and encoding explicitly. ``` ---load ---load +--load [noerror] +--load [noerror] ``` +By default, the load command raises an error if no tiddlers are found. The error can be suppressed by providing the optional "noerror" parameter. + To load tiddlers from an encrypted TiddlyWiki file you should first specify the password with the PasswordCommand. For example: ``` diff --git a/core/modules/commands/load.js b/core/modules/commands/load.js index 230a253d5..8fd9cba10 100644 --- a/core/modules/commands/load.js +++ b/core/modules/commands/load.js @@ -38,7 +38,7 @@ Command.prototype.execute = function() { count++; }); }); - if(!count) { + if(!count && self.params[1] !== "noerror") { self.callback("No tiddlers found in file \"" + self.params[0] + "\""); } else { self.callback(null);