2012-04-30 11:23:03 +00:00
title: CommandLineInterface
modifier: JeremyRuston
2012-05-20 17:47:11 +00:00
tags: feature
2012-04-30 11:23:03 +00:00
2012-05-20 14:59:04 +00:00
TiddlyWiki5 can be used on the command line to perform an extensive set of operations based on tiddlers, TiddlerFiles and TiddlyWikiFiles. For example, this loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in HTML:
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
node core/boot.js --verbose --load mywiki.html --savetiddler ReadMe ./readme.html
}}}
2012-05-19 17:23:14 +00:00
!!Usage
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
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 from left to right. The arguments are separated with spaces. The commands are identified by the prefix `--`.
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
2012-05-19 17:23:14 +00:00
node core/boot.js [--<option> [<arg>[,<arg>]]]
2012-05-20 14:59:04 +00:00
}}}
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
!!Commands
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
The following commands are available.
!!! load
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
Load tiddlers from 2.x.x TiddlyWiki files (`.html`), `.tiddler`, `.tid`, `.json` or other files
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--load <filepath>
}}}
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
!!! savetiddler
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
Save an individual tiddler as a specified MIME type, defaults to `text/html`
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--savetiddler <title> <filename> [<type>]
}}}
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
!!! wikitest
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
Run wikification tests against the tiddlers in the given directory. Include the `save` flag to save the test result files as the new targets.
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--wikitest <dir> [save]
}}}
2012-06-04 11:25:54 +00:00
2012-04-30 11:23:03 +00:00
`--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
2012-05-19 17:23:14 +00:00
!!! server
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
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`.
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--server <port> <roottiddler> <rendertype> <servetype>
}}}
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
For example:
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
{{{
--server 8080 $:/core/tiddlywiki5.template.html text/plain text/html
}}}
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
The parameters are:
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
{{{
--server <port> <roottiddler> <rendertype> <servetype>
}}}
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
* ''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")
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
!!! dump tiddlers
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
Dump the titles of the tiddlers in the wiki store
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--dump tiddlers
}}}
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
!!! dump tiddler
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
Dump the fields of an individual tiddler
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--dump tiddler <title>
}}}
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
!!! dump shadows
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
Dump the titles of the shadow tiddlers in the wiki store
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--dump shadows
}}}
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
!!! dump config
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
Dump the current core configuration
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--dump config
}}}
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
!!! verbose
2012-06-04 11:25:54 +00:00
2012-05-19 17:23:14 +00:00
Triggers verbose output, useful for debugging
2012-06-04 11:25:54 +00:00
2012-05-20 14:59:04 +00:00
{{{
--verbose
}}}