Command-line commands

The commands that can be used on the command line are listed here. Unless otherwise noted, commands can be used both with Rhapsody.exe and RhapsodyCL.exe.

In general, the following types of commands cannot be used with RhapsodyCL: diagram commands, configuration management commands, commands for running macros.

If you try to use a non-supported command with RhapsodyCL, the behavior of RhapsodyCL depends on whether you have set the -verbose switch:

Note: When making changes to projects under source control, check out the project before running RhapsodyCL.

-cmd=addtomodel <file location> <withdescendants|withoutdescendants>

Adds to the current model from the specified file location. The default value is <withoutdescendants>.

-cmd=arccheckout <file name> <label/revision> <locked|unlocked> <recursive|nonrecursive>

(cannot be used with RhapsodyCL.exe)

Checks out a file from the archive.

If you do not want to specify a <label/revision>, use NULL.

-cmd=buildwithdep

Builds a component with all its dependencies.

-cmd=call <plugin> <parameters for plugin>

Calls one of the Rational® Rhapsody® plug-ins and forwards the provided parameters to the plug‑in.

In contrast to all the other commands, the parameters for this command are provided as a single string enclosed in quotation marks (which are removed during processing). The first parameter in the string specifies the plug-in that is being called. The remainder of the string contains any parameters to be sent to the plug-in. You can send as many parameters to the plug-in as you want, but keep in mind that a parameter cannot contain spaces.

The following example shows the call command used to run TestConductor, where the plug-in name is "rtc":

For example:
D:\RhapsodyModels\Pbx.PBX.rpt -cmd=call "rtc run all"

For more information about calling .dll plug-ins, see http://www.ibm.com/support/docview.wss?uid=swg21411451.

To learn how to load a .dll plug-in into your Rational Rhapsody project, see http://www.ibm.com/support/docview.wss?uid=swg21411455.

-cmd=checkin <unit name> <label/revision> <locked|unlocked> <recursive|nonrecursive> <description>

(cannot be used with RhapsodyCL.exe)

Checks in a unit to an archive. If you do not want to specify a <label/revision>, use NULL.

For example, -cmd=checkin p1.sbs NULL locked recursive "my description"

-cmd=checkmodel

Starts a Check Model operation.

Set the current configuration before issuing this command.

-cmd=checkout <unit name> <label/revision> <locked|unlocked> <recursive|nonrecursive>

(cannot be used with RhapsodyCL.exe)

Checks out a unit from the archive. If you do not want to specify a <label/revision>, use NULL.

-cmd=close <NoSave>

Closes the open Rational Rhapsody model. By default, Rational Rhapsody automatically saves any changes you have made to the model before closing. If you do not want the product to save changes upon closing, use the NoSave parameter.

-cmd=closediagram <diagram type><diagram name>

(cannot be used with RhapsodyCL.exe)

Closes the specified diagram.

The first parameter specifies the type of diagram. This parameter can take one of the following values: omd, ucd, msc, collaboration, component.

The second parameter is the name of the diagram in the model.

Connecttoarc <archive location>

(cannot be used with RhapsodyCL.exe)

Connects to an archive. <archive location> includes the full path.

-cmd=creatediagram <diagram type><diagram name>

(cannot be used with RhapsodyCL.exe)

Creates a diagram.

The first parameter specifies the type of diagram. This parameter can take one of the following values: omd, ucd, msc, collaboration, component.

The second parameter is the name of the diagram in the model.

-cmd=exit

Closes the project and exits Rational Rhapsody.

-cmd=forceroundtrip

Performs a roundtrip regardless of the timestamps of the files.

-cmd=generate <component> <configuration>

Generates code for the specified component and configuration.

<component> and <configuration> are optional parameters. If not specified, the active component and configuration are used. Like the generate option in the GUI, this generates code only for modified elements. To regenerate all code, use the -regenerate command.

For example, -cmd=generate EXE Acme

If you want to generate code for more than one component, or for more than one configuration for a given component, you must repeat the generate command for each component/configuration combination, for example:

-cmd=generate compA cfg1 -cmd=generate compA cfg2 -cmd=generate compB cfg1

If you want to generate code for a nested component, use the syntax outerComponent::innerComponent, for example:

-cmd=generate def::abc DefaultConfig

Note: Do not use this command with RhapsodyCL.exe if you are using "customized code generation" or if you are generating code for the INTEGRITY operating system. Use the command with Rhapsody.exe instead.

-cmd=genwithdep

Generates a component with all its dependencies.

-cmd=GetCommandResult

Sends the result of the last command that was run to the standard output (or via the relevant socket in socket mode).

This command can only be used with RhapsodyCL.

Note: If you are using RhapsodyCL in socket mode, and you send the GetCommandResult command after sending a number of commands in a single line, the results of the individual commands must be read one at a time from the socket.

-cmd=gmr

Performs generate/make/run.

-cmd=import

Imports classes according to the reverse engineering settings stored in the current configuration. This command is equivalent to selecting Tools > Reverse Engineering in Rational Rhapsody.

-cmd=make

Builds the application, using the current configuration.

Make is an asynchronous command and must be the last of all commands in a script.

Because exit is a synchronous command, you cannot follow a make command with an exit (to close your project and exit Rational Rhapsody); doing so will cause the make to cease prematurely.

If you plan to run the application right after the make, use -syncmake instead of -make. This waits for the make to complete before running any additional commands.

-cmd=new <project location> <project name>

Creates a project in the specified location and assigns it the specified name.

-cmd=open <project name>

Opens the specified project. (RhapsodyCL.exe can only open projects. Rhapsody.exe can open units as well.)

-cmd=opendiagram <diagram type><diagram name>

(cannot be used with RhapsodyCL.exe)

Opens the specified diagram.

The first parameter specifies the type of diagram. This parameter can take one of the following values: omd, ucd, msc, collaboration, component.

The second parameter is the name of the diagram in the model.

-cmd=populatediagram <diagram type><diagram name>

(cannot be used with RhapsodyCL.exe)

Populates the specified diagram.

The first parameter specifies the type of diagram. This parameter can take one of the following values: omd, ucd, msc, collaboration, component.

The second parameter is the name of the diagram in the model.

-cmd=printcurrentdiagram

(cannot be used with RhapsodyCL.exe)

Prints the open diagram.

-cmd=regenerate <component> <configuration>

If model elements have been modified, generates code for the specified component and configuration.

<component> and <configuration> are optional parameters. If not specified, the active component and configuration are used.

If you want to generate code for more than one component, or for more than one configuration for a given component, you must repeat the regenerate command for each component/configuration combination, for example:

-cmd=regenerate compA cfg1 -cmd=regenerate compA cfg2 -cmd=regenerate compB cfg1

If you want to regenerate code for a nested component, use the syntax outerComponent::innerComponent, for example:

-cmd=regenerate def::abc DefaultConfig

Note: Do not use this command with RhapsodyCL.exe if you are using "customized code generation" or if you are generating code for the INTEGRITY operating system. Use the command with Rhapsody.exe instead.

-cmd=report <format> <name + location>

Generates a report.

<format> is the report format (RTF or ASCII). The file extension is added automatically (.rtf for RTF and .txt for ASCII).

<name + location> specifies the name and location of the report. These parameters are optional.

If you do not specify a name, the default file name is used (RhapsodyRep.rtf).

If you do not specify a location, the default location is used (the project directory).

Set the current configuration before issuing this command.

For example, -cmd=report RTF myReport

For RhapsodyCL, the report command uses the Rational Rhapsody internal reporter and does not extract diagrams.

-cmd=roundtrip

Roundtrips code changes back into the model.

Set the current configuration before issuing this command.

-cmd=runexternalprogram

Runs the specified external program.

(with RhapsodyCL.exe, cannot be used to run COM-based programs.)

-cmd=save

Saves the open project. Can be used after making changes like roundtrip, reverse engineering.

-cmd=saveas <project name>

Saves the project to a specified location. <project name> can include the path.

-cmd=setcomponent <active component name>

Sets the active component.

If you want to make a nested component the active component, use the syntax outerComponent::innerComponent, for example:

-cmd=setcomponent def::abc

-cmd=setconfiguration <active configuration name>

Sets the active configuration.

For example, -cmd=setconfiguration AcmeDebug

-cmd=setlog <log file>

Redirects the output normally sent to the output window to the specified log file. If the parameter does not specify the path, the log file is put in the "current" Rational Rhapsody directory. If a log file is specified, output is not sent to the standard output.

-cmd=setomroot <alternative OMROOT>

Sets the variable OMROOT to a new location. This variable specifies the root directory of the Rational Rhapsody installation.

For this command to take effect, this must be the first option specified in the command line.

-cmd=syncmake

Builds the application using the current configuration.

As opposed to the make command, the syncmake command waits until the make has completed before running any additional commands. So if you plan to run the application right after building it, use syncmake instead of make.


Feedback