TiddlyWiki5/tw5.com/tiddlers/CommandLineInterface.tid

112 wiersze
2.8 KiB
Plaintext

title: CommandLineInterface
modifier: JeremyRuston
tags: feature
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:
{{{
node core/boot.js --verbose --load mywiki.html --savetiddler ReadMe ./readme.html
}}}
!!Usage
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 `--`.
{{{
node core/boot.js [--<option> [<arg>[,<arg>]]]
}}}
!!Commands
The following commands are available.
!!! load
Load tiddlers from 2.x.x TiddlyWiki files (`.html`), `.tiddler`, `.tid`, `.json` or other files
{{{
--load <filepath>
}}}
!!! savetiddler
Save an individual tiddler as a specified MIME type, defaults to `text/html`
{{{
--savetiddler <title> <filename> [<type>]
}}}
!!! wikitest
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 <dir> [save]
}}}
`--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.
!!! server
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`.
{{{
--server <port> <roottiddler> <rendertype> <servetype>
}}}
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 tiddlers
Dump the titles of the tiddlers in the wiki store
{{{
--dump tiddlers
}}}
!!! dump tiddler
Dump the fields of an individual tiddler
{{{
--dump tiddler <title>
}}}
!!! dump shadows
Dump the titles of the shadow tiddlers in the wiki store
{{{
--dump shadows
}}}
!!! dump config
Dump the current core configuration
{{{
--dump config
}}}
!!! verbose
Triggers verbose output, useful for debugging
{{{
--verbose
}}}