Home > Articles > Programming

  • Print
  • + Share This
This chapter is from the book

Getting Started with the Command-Line Interface (CLI)

In the next chapter, we look at various development environments, including the command-line interface (CLI). Let's take a quick look at the CLI now just to get acquainted with it. As we saw, the CLI is a module retrieved from a remote module repository. There are many commands available, but don't let this scare you. The CLI is very helpful. To get a list of available commands, type the following:

zero help

The results of typing this into the command line can be seen in Listing 1.9.

Listing 1.9. Results of the "Zero Help" Command

Usage:  zero [main-opts] <task> [task-args]
main-opts:
  -d            enable minimal logging
  -v            enable all logging
  -l=<file>     use the given file to output log to

compile         Compiles all Java source files under the module's
/java           directory.
create          Creates a new module in the current directory.
help            Prints the documentation for the given command.
modulegroup     Manage modulegroups.
package         Packages the module as a zip file.
publish         Publish the module to your local repository.
repository      Manage repositories.
resolve         Determine the module's dependencies.
rollback        Reverts the effects of the last resolve or update.
search          Finds and prints all matching modules in the reposi-
                tory.
switch          Switch the module group.
update          Resolves a module to its latest dependencies.
version         Displays version information

As you can see, there are a bunch of available commands. Each command may have arguments that it can be given, but again the command line is very helpful. You need only to type the following to get help on a particular command:

zero help <command>

For example, if we use zero help search, we get the results shown in Listing 1.10.

Listing 1.10. Results of "Zero Help Search" in the CLI

Usage:

zero search <org:module[:revision]> [-remote] [-json]

The command uses the current module group to find in the local re-
pository for a module that matches the given <org:module:revision>
value and prints its search results. If no module name is given, the
command will print information about all available modules. You can
also use the -remote option to tell the command to search the remote
repository instead of the local one.

If the -json option is used the report is formatted as a JSON docu-
ment.

The return codes for this command are:
0 - success
1 - command failed

The search command enables you to search for modules in the repository. There are commands to create new IBM WebSphere sMash applications, start and stop applications, package applications, and many more. Spend some time familiarizing yourself with the commands, and we'll take another look at the CLI in the next chapter.

  • + Share This
  • 🔖 Save To Your Account