diff -r 000000000000 -r 7f656887cf89 documentation/cif_syntax.pod --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/documentation/cif_syntax.pod Wed Jun 23 15:52:26 2010 +0100 @@ -0,0 +1,220 @@ +# cif_syntax.pod +# +# Copyright (c) 2010 Accenture. All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Accenture - Initial contribution +# + +=head1 Command Info Files + +I + +=head2 Introduction + +Command Info Files (CIFs) can be used to define the interface and documentation for fshell commands that are implemented using CCommandBase. Where previously details of arguments and options etc. were specified in C++ source code, the majority of this information can now be defined in a CIF, which is a plain text file. The format of CIFs is similar to POD (Perl's documentation source format), but with an additional set of key-words that relate to the specifics of command interfaces. + +CIF files for fshell commands live in F<\resource\cif\fshell> and should be named I.cif where I is the same as what is returned by the command's Name() function. + +=head2 Syntax + +=head3 ==name + +The name of the command, without any prefix or suffix. Eg C<==name hello>. Mandatory. + +=head3 ==short-description + +A one-line summary of the functionality of the command. Mandatory. Eg: + + ==short-description + + Classic C example. + +=head3 ==long-description + +A fuller description of the command can go here. Full POD syntax is supported, including lists and multiple paragraphs. The POD is terminated by the next CIF double-equals line, or the end of the file. Optional. For example: + + ==long-description + + Intended to be an example of a minimal command implementation. Simply prints C to the console. + +=head3 ==argument [optional] [multiple | last] [] + +One argument section is specified for each argument that the command accepts. C is the type of the argument, one of the supported fshell types: int, int64, uint, uint64, string, filename, real, enum. See later for more details about the enum type. If a command doesn't take any arguments, then there will be no C<==argument> sections. Example: + + ==argument int priority + + The priority to set. + + ==argument filename file optional multiple + + File or files to open. If not specified, opens an untitled document. + +The rules for the attributes are: + +=over 4 + +=item * + +An argument with the C attribute cannot be followed by a non-optional argument. + +=item * + +Only the final argument is allowed to have the C attribute set. + +=item * + +An argument with just the C attribute can be specified one or more times, C means zero or one times. An argument may have both C and C to indicate it can be specified zero or more times. + +=item * + +Only the final argument is allowed to have the C attribute. It indicates that further arguments are allowed without needing to quote them and will be merged into this argument. C may not be combined with C. If a string provided for a C argument naturally (i.e. as a result of normal string quote and escape handling) forms a single argument and consumes the whole of the remainder of the command line, the resulting single argument will be used as is. Otherwise, the string will be used without any quote or escape handling. Here are some example (using fshell's 'time' command, which takes a single argument that uses the C attribute): + + Input command-line Argument receive by the 'time' command + + 1) time echo foo echo foo + 2) time 'echo foo' echo foo + 3) time echo^ foo echo foo + 4) time echo foo && echo bar echo foo (note, fshell intercepts the '&&' and launches 'echo bar' separately). + 5) time 'echo foo && echo bar' echo foo && echo bar + 6) time echo -h echo -h + +Note, the presence of C in C