9.2 The usage of command line parameters
All the commands have the same structure: the first parameter
is a command name. The command name shows how many arguments it expects
according to the number of colons in the name: logoutAndExit expects no
arguments, setProject: expects one argument, and loginDB:user:password: expects
three arguments – a database name, user name, and password. Note that for
commands that expect arguments, there are no spaces in the command name, and the
last character is always a colon.
After a command name expecting N arguments, the next N
parameters on the command line will be used as those arguments.
As an example, consider the following command line that
would login to the ‘demo’ repository, open the ‘Watch’
project, run the ‘Autobuild’ generator for all WatchFamily diagrams,
and then logout:
mep45.exe loginDB:user:password: demo user user setProject: Watch forAll:run: WatchFamily Autobuild commit logoutAndExit
Here,
mep45.exe is the name of the MetaEdit+
program executable. The first parameter given to the executable is
loginDB:user:password: with its
arguments demo,
user and
user. The second command and its
argument is setProject: and
Watch. The third command,
forAll:run:, is followed by its two
arguments: WatchFamily and
Autobuild. The two last commands,
commit and
logoutAndExit, do not have any
arguments.
Please note that if you start the API from the command
line, you do not want to add the
logoutAndExit command into that same
command line – if you do, the execution of MetaEdit+ is halted before your
API utilization can take place. So, do not logout from the command line, but
instead call logoutAndExit as the final API command.
When using the API from a generator, best is to start the
API with internal...execute, but have the program that will use it close it with
an API call to stopAPI. Alternatively a generator can send stopAPI first (a
no-op if none are running), then startAPI. This will ensure that there is just
one API Tool running.