Chapter 11. Tips and Tricks for Using the CLI

JBoss ON CLI scripts make it possible to automate tasks, from simply importing discovered resources to running complex management operations to remedy configuration drift or schedule web app upgrades.
The JBoss ON CLI has some usability features to make it easier to use interactively for developing scripts, to integrate with system tools to help task automation, and to create custom functions for more versatile, real-life applications.

11.1. Using Tab Complete

In interactive mode, the JBoss ON CLI is aware of the implicit variables (Chapter 7, Available Implicit Variables in the JBoss ON API) in the domain API and the JBoss ON remote API, as well as the specific CLI commands and methods (Chapter 8, Methods Specific to the JBoss ON CLI). When running the CLI interactively, any of these methods can be filled in using Tab complete.
Filling in part of a class lists potential matching classes (or, if it matches, commands). For example:
[jsmith@server bin]# ./ -u rhqadmin -p rhqadmin
  RHQ Enterprise Remote CLI 3.3
  Remote server version is: 3.3 (2484565)
  Login successful
  rhqadmin@localhost:7080$ Resource

  ResourceFactoryManager   ResourceGroupManager     ResourceManager

  rhqadmin@localhost:7080$ ex

  exporter   exec
After selecting a class, hitting Tab once lists all of the methods for that class.
rhqadmin@localhost:7080$ ResourceManager.

  availabilitySummary           disableResources
  enableResources               findChildResources
  findResourceLineage           findResourcesByCriteria
  getAvailabilitySummary        getLiveResourceAvailability
  getParentResource             getResource
  getResourcesAncestry          liveResourceAvailability
  parentResource                resource
  toString                      uninventoryResources
Hitting Tab twice prints the full method signatures:
           List<Integer> enableResources(GenericArrayTypeImpl[int])
           Resource updateResource(Resource resource)
           List<Integer> uninventoryResources(GenericArrayTypeImpl[int] resourceIds)
	   ResourceAvailabilitySummary getAvailabilitySummary(int resourceId)
           PageList<Resource> findChildResources(int resourceId, PageControl pageControl)
           Map<Integer,String> getResourcesAncestry(GenericArrayTypeImpl[Integer] resourceIds, ResourceAncestryFormat format)
           List<Integer> disableResources(GenericArrayTypeImpl[int])
           List<Resource> findResourceLineage(int resourceId)
	   ResourceAvailability getLiveResourceAvailability(int resourceId)
           PageList<Resource> findResourcesByCriteria(ResourceCriteria criteria)
           Resource getResource(int resourceId)
           String toString()
	   Resource getParentResource(int resourceId)
Autocomplete is very useful for finding what methods or objects are implicitly available, for building criteria-based searches (because it is easier to select criteria), and for developing server scripts.