@CliCommand(value = LIST_MODULES, help = "List runtime modules")
	public Table listDeployedModules(
			@CliOption(mandatory = false, key = { "containerId" }, help = "to filter by container id") String containerId,
			@CliOption(mandatory = false, key = { "moduleId" }, help = "to filter by module id") String moduleId) {
		Iterable<ModuleMetadataResource> runtimeModules;
		if (StringUtils.hasText(containerId) && StringUtils.hasText(moduleId)) {
			runtimeModules = Collections.singletonList(runtimeOperations().listDeployedModule(containerId, moduleId));
		}
		else if (StringUtils.hasText(containerId)) {
			runtimeModules = runtimeOperations().listDeployedModulesByContainer(containerId);
		}
		else if (StringUtils.hasText(moduleId)) {
			runtimeModules = runtimeOperations().listDeployedModulesByModuleId(moduleId);
		}
		else {
			runtimeModules = runtimeOperations().listDeployedModules();
		}
		final Table table = new Table();
		table.addHeader(1, new TableHeader("Module Id")).addHeader(2,
				new TableHeader("Container Id")).addHeader(3, new TableHeader("Options")).addHeader(4,
				new TableHeader("Deployment Properties")).addHeader(5, new TableHeader("Unit status"));
		for (ModuleMetadataResource module : runtimeModules) {
			final TableRow row = table.newRow();
			String unitStatus = (module.getDeploymentStatus() != null) ? module.getDeploymentStatus().name() : "";
			row.addValue(1, String.format("%s.%s.%s", module.getUnitName(), module.getModuleType(), module.getName()))
					.addValue(2, module.getContainerId()).addValue(3, module.getModuleOptions().toString()).addValue(4,
							module.getDeploymentProperties().toString()).addValue(5, unitStatus);
		}
		return table;
	}
Commands to interact with cluster for containers/modules.

@author Ilayaperumal Gopinathan
spring-xd-shell/src/main/java/org/springframework/xd/shell/command/RuntimeCommands.java