1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-09-10 06:46:06 +00:00

Rename "dump" command to "print" command

Being pan-cultural is hard.
This commit is contained in:
Jeremy Ruston
2013-08-09 09:24:58 +01:00
parent 7e82eb13eb
commit 46b2fde2d9
3 changed files with 52 additions and 48 deletions

View File

@@ -1,9 +1,9 @@
/*\ /*\
title: $:/core/modules/commands/dump.js title: $:/core/modules/commands/print.js
type: application/javascript type: application/javascript
module-type: command module-type: command
Dump command for inspecting TiddlyWiki internals Print command for inspecting TiddlyWiki internals
\*/ \*/
(function(){ (function(){
@@ -13,7 +13,7 @@ Dump command for inspecting TiddlyWiki internals
"use strict"; "use strict";
exports.info = { exports.info = {
name: "dump", name: "print",
synchronous: true synchronous: true
}; };
@@ -25,13 +25,13 @@ var Command = function(params,commander) {
Command.prototype.execute = function() { Command.prototype.execute = function() {
if(this.params.length < 1) { if(this.params.length < 1) {
return "Too few parameters for dump command"; return "Too few parameters for print command";
} }
var subcommand = this.subcommands[this.params[0]]; var subcommand = this.subcommands[this.params[0]];
if(subcommand) { if(subcommand) {
return subcommand.call(this); return subcommand.call(this);
} else { } else {
return "Unknown subcommand (" + this.params[0] + ") for dump command"; return "Unknown subcommand (" + this.params[0] + ") for print command";
} }
}; };
@@ -39,7 +39,7 @@ Command.prototype.subcommands = {};
Command.prototype.subcommands.tiddler = function() { Command.prototype.subcommands.tiddler = function() {
if(this.params.length < 2) { if(this.params.length < 2) {
return "Too few parameters for dump tiddler command"; return "Too few parameters for print tiddler command";
} }
var tiddler = this.commander.wiki.getTiddler(this.params[1]); var tiddler = this.commander.wiki.getTiddler(this.params[1]);
if(!tiddler) { if(!tiddler) {
@@ -80,11 +80,11 @@ Command.prototype.subcommands.config = function() {
return "[\"" + $tw.utils.stringify(p) + "\"]"; return "[\"" + $tw.utils.stringify(p) + "\"]";
} }
}, },
dumpConfig = function(object,prefix) { printConfig = function(object,prefix) {
for(var n in object) { for(var n in object) {
var v = object[n]; var v = object[n];
if(typeof v === "object") { if(typeof v === "object") {
dumpConfig(v,prefix + "." + quotePropertyName(n)); printConfig(v,prefix + "." + quotePropertyName(n));
} else if(typeof v === "string") { } else if(typeof v === "string") {
self.output.write(prefix + "." + quotePropertyName(n) + ": \"" + $tw.utils.stringify(v) + "\"\n"); self.output.write(prefix + "." + quotePropertyName(n) + ": \"" + $tw.utils.stringify(v) + "\"\n");
} else { } else {
@@ -92,20 +92,20 @@ Command.prototype.subcommands.config = function() {
} }
} }
}, },
dumpObject = function(heading,object) { printObject = function(heading,object) {
self.output.write(heading +"\n"); self.output.write(heading +"\n");
for(var n in object) { for(var n in object) {
self.output.write(" " + n + "\n"); self.output.write(" " + n + "\n");
} }
}; };
this.output.write("Configuration:\n"); this.output.write("Configuration:\n");
dumpConfig($tw.config," $tw.config"); printConfig($tw.config," $tw.config");
dumpObject("Tiddler field modules:",$tw.Tiddler.fieldModules); printObject("Tiddler field modules:",$tw.Tiddler.fieldModules);
dumpObject("Loaded modules:",$tw.modules.titles); printObject("Loaded modules:",$tw.modules.titles);
dumpObject("Command modules:",$tw.commands); printObject("Command modules:",$tw.commands);
dumpObject("Parser modules:",$tw.wiki.parsers); printObject("Parser modules:",$tw.wiki.parsers);
dumpObject("Macro modules:",$tw.wiki.macros); printObject("Macro modules:",$tw.wiki.macros);
dumpObject("Deserializer modules:",$tw.Wiki.tiddlerDeserializerModules); printObject("Deserializer modules:",$tw.Wiki.tiddlerDeserializerModules);
return null; // No error return null; // No error
}; };

View File

@@ -1,34 +1,36 @@
title: DumpCommand title: PrintCommand
tags: docs command tags: docs command
!!! dump tiddlers The `print` command outputs specified information.
Dump the titles of the tiddlers in the wiki store !!! print tiddlers
Output the titles of the tiddlers in the wiki store
``` ```
--dump tiddlers --print tiddlers
``` ```
!!! dump tiddler !!! print tiddler
Dump the fields of an individual tiddler Print the fields of an individual tiddler
``` ```
--dump tiddler <title> --print tiddler <title>
``` ```
!!! dump system !!! print system
Dump the titles of the system tiddlers in the wiki store Print the titles of the system tiddlers in the wiki store
``` ```
--dump systems --print system
``` ```
!!! dump config !!! print config
Dump the current core configuration Print the current core configuration
``` ```
--dump config --print config
``` ```

View File

@@ -126,25 +126,6 @@ The following commands are available:</p><div class='tw-list-frame'>
<div class='tw-transclude'> <div class='tw-transclude'>
<h3 class=''> <h3 class=''>
<span class='tw-view-link'> <span class='tw-view-link'>
<a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/DumpCommand.html'>
DumpCommand</a></span></h3><div>
<div class='tw-transclude'>
<h3 class=''>
dump tiddlers</h3><p>
Dump the titles of the tiddlers in the wiki store </p><pre>
--dump tiddlers</pre><h3 class=''>
dump tiddler</h3><p>
Dump the fields of an individual tiddler </p><pre>
--dump tiddler &lt;title&gt;</pre><h3 class=''>
dump system</h3><p>
Dump the titles of the system tiddlers in the wiki store </p><pre>
--dump systems</pre><h3 class=''>
dump config</h3><p>
Dump the current core configuration </p><pre>
--dump config</pre></div></div></div></div><div class='tw-list-element'>
<div class='tw-transclude'>
<h3 class=''>
<span class='tw-view-link'>
<a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/LoadCommand.html'> <a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/LoadCommand.html'>
LoadCommand</a></span></h3><div> LoadCommand</a></span></h3><div>
<div class='tw-transclude'> <div class='tw-transclude'>
@@ -159,6 +140,27 @@ TiddlyWiki</a> files (<code>
<div class='tw-transclude'> <div class='tw-transclude'>
<h3 class=''> <h3 class=''>
<span class='tw-view-link'> <span class='tw-view-link'>
<a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/PrintCommand.html'>
PrintCommand</a></span></h3><div>
<div class='tw-transclude'>
<p>
The <code>
print</code> command outputs specified information. </p><h3 class=''>
print tiddlers</h3><p>
Output the titles of the tiddlers in the wiki store</p><pre>
--print tiddlers</pre><h3 class=''>
print tiddler</h3><p>
Print the fields of an individual tiddler </p><pre>
--print tiddler &lt;title&gt;</pre><h3 class=''>
print system</h3><p>
Print the titles of the system tiddlers in the wiki store </p><pre>
--print system</pre><h3 class=''>
print config</h3><p>
Print the current core configuration </p><pre>
--print config</pre></div></div></div></div><div class='tw-list-element'>
<div class='tw-transclude'>
<h3 class=''>
<span class='tw-view-link'>
<a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/RenderTiddlerCommand.html'> <a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/RenderTiddlerCommand.html'>
RenderTiddlerCommand</a></span></h3><div> RenderTiddlerCommand</a></span></h3><div>
<div class='tw-transclude'> <div class='tw-transclude'>