diff --git a/doc/cli/cli.txt b/doc/cli/cli.txt new file mode 100644 index 00000000..721d2fff --- /dev/null +++ b/doc/cli/cli.txt @@ -0,0 +1,72 @@ +Interactive command line interface + +DOC_MSE_VERSION: since 0.3.7 + +--Description-- + +]]mse --cli [my-set.mse-set] + +The MSE interactive command line interface provides a way to work with set files without a graphical environment. +The CLI shows a prompt where commands can be entered, which are then executed by MSE. + +--Commands-- + +! Command Short version Description +| @:help@ @:?@ Show a help screen describing the available commands. +| @:quit@ @:q@ Quit the interactive cli. +| @:load@ @:l@ Load a set file. The current set will be unloaded. + For example: + ]:load my-set.mse-set +| @:reset@ @:r@ Clear all variable definitions. +| @:!@ Perform a shell command. For example @:! dir@ shows a directory listing. +| ''other'' Execute the command as a line of [[type:script]] code. + The script has access to the loaded set and all [[fun:index|built in functions]]. + +--Raw mode-- + +]mse.exe --cli --raw + +For interfacing MSE with other programs the raw mode is most convenient. + +In the raw mode the only output is in response to commands. +For each command a single ''record'' is written to the standard output. +The records consists of: + * A line with an integer status code, @0@ for ok, @1@ for warnings, @2@ for errors. + * A line containing an integer ''k'', the number of lines to follow. + * ''k'' lines, each containing UTF-8 encoded string data. + +Strings are not further encoded or escaped. + +In this mode multi line strings can be transfered from MSE without much encoding/parsing hastle. + +The behaviour of the raw mode is guaranteed not to change between versions of MSE (subject to bugs and changes in the scripting language), +for the normal mode no such guarantee is made. + +--Example-- + +Here is an example session, the text entered by the user is shown in blue. + +]]$ mse --cli +] ___ +] __ __ _ ___ _ ___ _ _ _ |__ \ +] | \/ |__ _ __ _(_)__ / __|___| |_ | __|__| (_) |_ ___ _ _ ) | +] | |\/| / _` / _` | / _| \__ | -_) _| | _|/ _` | | _/ _ \ '_| / / +] |_| |_\__,_\__, |_\__| |___|___|\__| |___\__,_|_|\__\___/_| / /_ +] |___/ |____| +] +]]> :load myset.mse-set +]]> first_card := set.cards.0 # the first card +][[card]] +>>>>> first_card.name +]"Pineapple of Doom" +>>>>> write_image_file(first_card, file: "firstcard.jpg") +]]> # the image file "firstcard.jpg" is now saved +]]> :! dir +]2008-08-04 22:57 92 891 firstcard.jpg +] 1 File(s) 92 891 bytes +] 0 Dir(s) 986 562 560 bytes free +]]> :reset +]]> first_card.name # variable was cleared +]]ERROR: Variable not set: first_card +]]> :quit +]Goodbye diff --git a/doc/cli/index.txt b/doc/cli/index.txt new file mode 100644 index 00000000..01d7ea2a --- /dev/null +++ b/doc/cli/index.txt @@ -0,0 +1,53 @@ +MSE Command line + +Magic set editor can be started from the command prompt by typing: + +]mse +in Windows, or +]magicseteditor +on other platforms. + +The MSE program has several flags for choosing different behaviour. + +--Starting the GUI-- + +]mse +Invoking MSE with no arguments shows the welcome window. + +]]mse my-set.mse-set +Invoking MSE with the filename of a [[type:set]] shows the main window with that set loaded. +This command is automatically invoked when you double click on a set file in a file manager. + +]mse my-symbol.mse-symbol +Invoking MSE with the filename of a [[type:symbol]] shows the symbol editor window with that symbol loaded. + +]mse --symbol-editor +With the --symbol-editor flag the symbol editor is started with a blank symbol. + +--Information about MSE-- + +]mse --version +The --version flag (abbreviate as -v) writes the version number of MSE to the standard output, + or in a message box if MSE was not started from the command prompt. + +]mse --help +The --help flag (abbreviate as -?) displays a list of available flags to the standard output, + or in a message box if MSE was not started from the command prompt. + +--Installers-- + +]]mse my-installer.mse-installer +Invoking MSE with the filename of an [[type:installer]] shows the package window, from where the packages in that installer can be installed. +By passing the --local or --global flag you can change where the package will be installed. +Global installation is for all users, local installation is for the current user only (see [[file:index|data directories]]). + +]mse --create-installer output.mse-installer package1.mse-game package2.mse-game ... +Creates an installer package containing one or more packages from the mse [[file:index|data directory]]. +The installer will be written to output.mse-installer. This name can be ommitted, in which case the name of the forst package will be used (in this case package1.mse-installer). + +--Interactive cli interface-- + +]mse --cli +Starts the [[cli:cli|Interactive command line interface]]. +Optionally the filename of a set can be passed which will then be loaded. + diff --git a/doc/index.txt b/doc/index.txt index 270c6cf0..77fc333f 100644 --- a/doc/index.txt +++ b/doc/index.txt @@ -6,6 +6,9 @@ These documents describe the file formats and scirpting language used by the pro There is currently no information on how to ''use'' the program for making cards. --Topics-- +Using the program: +* [[doc/cli|Invoking MSE from the command line]] +Templates: * [[doc/tutorial|Templating tutorial]] (comming soon) * [[doc/file|File formats]] * [[doc/type|Data types used in the files]] diff --git a/src/mse.vcproj b/src/mse.vcproj index 36928cad..d313f828 100644 --- a/src/mse.vcproj +++ b/src/mse.vcproj @@ -3405,6 +3405,12 @@ + + + + + + + + + + @@ -3815,6 +3830,19 @@ RelativePath="..\doc\type\word_list_word.txt"> + + + + + + + + ') $text = substr($text,0,-6); else $text .= '
';
-			$text .= htmlspecialchars(substr($line, 1));
+			if (substr($line,0,2)==']]') { // unescaped
+				$text .= substr($line, 2);
+			} else {
+				$text .= htmlspecialchars(substr($line, 1));
+			}
 			$text .= "\n
"; - $state = ']'; + $state = '>'; // Html } elseif (preg_match("@^)@", $line)) { @@ -285,7 +289,7 @@ function autoformat__link_s($matches) { } function autoformat__url($url) { - if (preg_match("/^(type|fun|script|file):(.*)/i",$url,$matches)) { + if (preg_match("/^(type|fun|script|file|cli):(.*)/i",$url,$matches)) { $part = $matches[1]; if ($part == 'fun') $part = 'function'; $sub = str_replace(' ','_',strtolower($matches[2]));