1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Provide an option for the load command to not error if no tiddlers are found

This commit is contained in:
Jermolene 2019-03-08 16:43:04 +00:00
parent 07635d7b3e
commit 12630d4a91
2 changed files with 5 additions and 3 deletions

View File

@ -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 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 <filepath> --load <filepath> [noerror]
--load <dirpath> --load <dirpath> [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: To load tiddlers from an encrypted TiddlyWiki file you should first specify the password with the PasswordCommand. For example:
``` ```

View File

@ -38,7 +38,7 @@ Command.prototype.execute = function() {
count++; count++;
}); });
}); });
if(!count) { if(!count && self.params[1] !== "noerror") {
self.callback("No tiddlers found in file \"" + self.params[0] + "\""); self.callback("No tiddlers found in file \"" + self.params[0] + "\"");
} else { } else {
self.callback(null); self.callback(null);