1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-23 02:55:48 +00:00
TiddlyWiki5/tw5.com/tiddlers/CommandLineInterface.tid

77 lines
3.1 KiB
Plaintext
Raw Normal View History

title: CommandLineInterface
modifier: JeremyRuston
TiddlyWiki5 can be used on the command line to perform an extensive set of operations based on RecipeFiles, TiddlerFiles and TiddlyWikiFiles.
!! Examples
2012-05-04 16:46:01 +00:00
This example loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in HTML:
`
2012-05-05 10:22:13 +00:00
node tiddlywiki.js --verbose --load mywiki.html --savetiddler ReadMe ./readme.html
`
!!Usage
`
node core/boot.js [--<option> [<arg>[,<arg>]]]
`
Running `boot.js` from the command line boots the TiddlyWiki kernel, loads the core plugins and establishes an empty wiki store. It then sequentially processes the command line arguments. The arguments are separated with spaces. The commands are identified by the prefix `--`.
The commands are processed sequentially from left to right. Processing pauses during long operations and then resumes with the next command in sequence
!!Commands
The following commands are available.
!!! load
`--load <filepath>`
Load tiddlers from 2.x.x TiddlyWiki files (`.html`), `.tiddler`, `.tid`, `.json` or other files
!!! savetiddler
`--savetiddler <title> <filename> [<type>]`
Save an individual tiddler as a specified MIME type, defaults to `text/html`
!!! wikitest
`--wikitest <dir> [save]`
Run wikification tests against the tiddlers in the given directory. Include the `save` flag to save the test result files as the new targets.
`--wikitest` looks for `*.tid` files in the specified folder. It then wikifies the tiddlers to both "text/plain" and "text/html" format and checks the results against the content of the `*.html` and `*.txt` files in the same directory.
2012-05-05 22:08:00 +00:00
!!! server
`--server <port> <roottiddler> <rendertype> <servetype>`
The server is very simple. At the root, it serves a rendering of a specified tiddler. Away from the root, it serves individual tiddlers encoded in JSON, and supports the basic HTTP operations for GET, PUT and DELETE.
For example:
{{{
--server 8080 $:/core/tiddlywiki5.template.html text/plain text/html
}}}
The parameters are:
{{{
--server <port> <roottiddler> <rendertype> <servetype>
}}}
* ''port'' - port number to serve from (defaults to "8080")
* ''roottiddler'' - the tiddler to serve at the root (defaults to "$:/core/tiddlywiki5.template.html")
* ''rendertype'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
* ''servetype'' - the content type with which the root tiddler should be served (defaults to "text/html")
!!! dump
`--dump tiddlers`
Dump the titles of the tiddlers in the wiki store
!!! dump
`--dump tiddler <title>`
Dump the fields of an individual tiddler
!!! dump
`--dump shadows`
Dump the titles of the shadow tiddlers in the wiki store
!!! dump
`--dump config`
Dump the current core configuration
!!! verbose
`--verbose`
Triggers verbose output, useful for debugging
!!Trying it out
For trying TiddlyWiki5 out under `node.js`, two batch files are provided:
2012-05-05 22:08:00 +00:00
* `run.sh` boots the kernel and loads the core modules and then outputs the `$tw` global for inspection
* `bld.sh` builds the new TiddlyWiki 5 HTML file (placed in the `tmp/tw5/` directory by default)