1 /******************************************************************************* 2 * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * Marc R. Hoffmann - initial API and implementation 10 * 11 *******************************************************************************/ 12 package org.jacoco.cli.internal.commands; 13 14 import java.util.Arrays; 15 import java.util.List; 16 17 import org.jacoco.cli.internal.Command; 18 19 /** 20 * List of all available commands. 21 */ 22 public final class AllCommands { 23 24 private AllCommands() { 25 } 26 27 /** 28 * @return list of new instances of all available commands 29 */ 30 public static List<Command> get() { 31 return Arrays.asList(new Dump(), new Instrument(), new Merge(), 32 new Report(), new ClassInfo(), new ExecInfo(), new Version()); 33 } 34 35 /** 36 * @return String containing all available command names 37 */ 38 public static String names() { 39 final StringBuilder sb = new StringBuilder(); 40 for (final Command c : get()) { 41 if (sb.length() > 0) { 42 sb.append('|'); 43 } 44 sb.append(c.name()); 45 } 46 return sb.toString(); 47 } 48 49 } 50