Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 376319 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/HelpCommand.java (-5 / +22 lines)
Lines 89-94 public class HelpCommand { Link Here
89
	/**
89
	/**
90
	 * Provides help for the available commands. Prints the names, descriptions and parameters of all registered commands.
90
	 * Provides help for the available commands. Prints the names, descriptions and parameters of all registered commands.
91
	 * 
91
	 * 
92
	 * If -scope <command_scope> is passed to the command, help is printed only for the commands with the specified scope. 
93
	 * 
92
	 * If a command name is passed as argument to the help command, then the help
94
	 * If a command name is passed as argument to the help command, then the help
93
	 * message only for the particular command is displayed (if such is defined).
95
	 * message only for the particular command is displayed (if such is defined).
94
	 *  
96
	 *  
Lines 98-106 public class HelpCommand { Link Here
98
	 */
100
	 */
99
	public void help(final CommandSession session, String... args) throws Exception {
101
	public void help(final CommandSession session, String... args) throws Exception {
100
		String command = null;
102
		String command = null;
103
		String scope = null;
101
		
104
		
102
		if (args.length > 0) {
105
		if (args.length > 0) {
103
			command = args[0];
106
			if (args[0].equals("-scope")) {
107
				if (args.length < 2) {
108
					System.out.println("Specify scope");
109
					return;
110
				} else {
111
					scope = args[1];
112
				}
113
			} else {
114
				command = args[0];
115
			}
104
		}
116
		}
105
		
117
		
106
		if (command != null) {
118
		if (command != null) {
Lines 109-116 public class HelpCommand { Link Here
109
			return;
121
			return;
110
		}
122
		}
111
123
112
		printAllLegacyCommandsHelp();
124
		
113
		printAllGogoCommandsHelp(session);
125
		if ((scope == null) || "equinox".equals(scope)) {
126
			printAllLegacyCommandsHelp();
127
		}
128
		printAllGogoCommandsHelp(session, scope);
114
	}
129
	}
115
130
116
	private void printGogoCommandHelp(final CommandSession session, String command) throws Exception {
131
	private void printGogoCommandHelp(final CommandSession session, String command) throws Exception {
Lines 127-138 public class HelpCommand { Link Here
127
		}
142
		}
128
	}
143
	}
129
144
130
	private void printAllGogoCommandsHelp(final CommandSession session) throws Exception {
145
	private void printAllGogoCommandsHelp(final CommandSession session, String scope) throws Exception {
131
		@SuppressWarnings("unchecked")
146
		@SuppressWarnings("unchecked")
132
		Set<String> commandNames = (Set<String>) session.get(COMMANDS);
147
		Set<String> commandNames = (Set<String>) session.get(COMMANDS);
133
		
148
		
134
		try {
149
		try {
135
			for (String commandName : commandNames) {
150
			for (String commandName : commandNames) {
151
				if (scope != null && !commandName.startsWith(scope + ":")) {
152
					continue;
153
				}
136
				session.execute("felix:help " + commandName);
154
				session.execute("felix:help " + commandName);
137
			}
155
			}
138
		} catch (IllegalArgumentException e) {
156
		} catch (IllegalArgumentException e) {
139
- 

Return to bug 376319