Skip to content

Commit

Permalink
Fix "openhab --help" and "help openhab" in Karaf console (#2953)
Browse files Browse the repository at this point in the history
* Enable "openhab --help" and "help openhab" in Karaf console

Signed-off-by: Jan N. Klug <github@klug.nrw>
  • Loading branch information
J-N-K committed May 16, 2022
1 parent 9100473 commit b52d9f2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions bundles/org.openhab.core.io.console.karaf/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Karaf-Commands: org.openhab.core.io.console.karaf.internal
6 changes: 6 additions & 0 deletions bundles/org.openhab.core.io.console.karaf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
<artifactId>org.openhab.core.io.console</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.wrapper</groupId>
<artifactId>org.apache.karaf.wrapper.core</artifactId>
<version>${karaf.compile.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.karaf.shell.api.action.Action;
import org.apache.karaf.shell.api.action.lifecycle.Reference;
Expand Down Expand Up @@ -66,7 +65,7 @@ public CommandWrapper(final ConsoleCommandExtension command) {

@Override
public Object execute(Session session, List<Object> argList) throws Exception {
String[] args = argList.stream().map(a -> a.toString()).collect(Collectors.toList()).toArray(new String[0]);
String[] args = argList.stream().map(Object::toString).toArray(String[]::new);

final Console console = new OSGiConsole(getScope(), session.getConsole());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.karaf.internal.command;
package org.openhab.core.io.console.karaf.internal;

import static org.apache.karaf.shell.support.ansi.SimpleAnsi.*;

Expand Down
2 changes: 0 additions & 2 deletions bundles/org.openhab.core.karaf/bnd.bnd

This file was deleted.

6 changes: 0 additions & 6 deletions bundles/org.openhab.core.karaf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
<version>${karaf.compile.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.wrapper</groupId>
<artifactId>org.apache.karaf.wrapper.core</artifactId>
<version>${karaf.compile.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.jaas</groupId>
<artifactId>org.apache.karaf.jaas.modules</artifactId>
Expand Down
1 change: 1 addition & 0 deletions features/karaf/openhab-core/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
<feature name="openhab-core-io-console-karaf" description="Karaf Console support for SmartHome stuff" version="${project.version}">
<feature>openhab-core-base</feature>
<feature>shell</feature>
<feature>service-wrapper</feature>
<bundle>mvn:org.openhab.core.bundles/org.openhab.core.io.console.karaf/${project.version}</bundle>
</feature>

Expand Down
2 changes: 1 addition & 1 deletion tools/static-code-analysis/pmd/suppressions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ org.openhab.core.ui.internal.proxy.ProxyServletService=AvoidCatchingThrowable
org.openhab.core.automation.internal.RuleEngineImpl=AvoidCatchingThrowable
org.openhab.core.automation.internal.RuleRegistryImpl=CompareObjectsWithEquals
org.openhab.core.automation.internal.provider.AutomationResourceBundlesEventQueue=AvoidCatchingThrowable
org.openhab.core.karaf.internal.command.InstallServiceCommand=SystemPrintln
org.openhab.core.io.console.karaf.internal.InstallServiceCommand=SystemPrintln

0 comments on commit b52d9f2

Please sign in to comment.