1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-09 19:39:57 +00:00
TiddlyWiki5/tw5.com/tiddlers/CommandLineInterface.tid

112 lines
2.8 KiB
Plaintext
Raw Normal View History

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