karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [6/6] karaf git commit: [KARAF-4570] Upgrade to JLine 3
Date Tue, 14 Jun 2016 13:23:21 GMT
[KARAF-4570] Upgrade to JLine 3

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/b4ae5245
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/b4ae5245
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/b4ae5245

Branch: refs/heads/master
Commit: b4ae5245cbec658e6be2b1df6366786a4c6824ab
Parents: d4002ba
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Tue Jun 14 11:54:43 2016 +0200
Committer: Guillaume Nodet <gnodet@apache.org>
Committed: Tue Jun 14 15:23:00 2016 +0200

----------------------------------------------------------------------
 assemblies/apache-karaf-minimal/pom.xml         |   1 +
 assemblies/apache-karaf/pom.xml                 |   1 +
 assemblies/features/framework/pom.xml           |   4 -
 .../standard/src/main/feature/feature.xml       |   2 +-
 .../apache/karaf/bundle/command/Classes.java    |   7 +-
 .../apache/karaf/bundle/command/Headers.java    |  13 +-
 .../main/java/org/apache/karaf/client/Main.java | 399 +++------
 demos/profiles/registry/pom.xml                 |   2 +-
 .../completers/FeatureCompleterSupport.java     |  25 +-
 .../core/internal/InstanceServiceImpl.java      |  10 +-
 .../org/apache/karaf/instance/main/Execute.java |   3 -
 .../org/apache/karaf/itests/FeatureTest.java    |   4 +-
 main/pom.xml                                    |   2 +-
 pom.xml                                         |  36 +-
 profile/pom.xml                                 |   6 -
 .../karaf/profile/command/ProfileEdit.java      |  39 +-
 shell/commands/pom.xml                          |   7 -
 .../karaf/shell/commands/impl/DateAction.java   | 125 +--
 .../karaf/shell/commands/impl/EditAction.java   | 149 +---
 .../karaf/shell/commands/impl/GrepAction.java   |  15 +-
 .../shell/commands/impl/HistoryAction.java      |  26 +-
 .../karaf/shell/commands/impl/InfoAction.java   |   8 +-
 .../karaf/shell/commands/impl/LessAction.java   | 852 +------------------
 shell/console/pom.xml                           |  12 +-
 .../karaf/shell/commands/ansi/SimpleAnsi.java   |  13 +-
 .../shell/console/factory/ConsoleFactory.java   |  31 -
 .../apache/karaf/shell/console/impl/Main.java   | 348 --------
 .../shell/console/impl/jline/Branding.java      |  93 --
 .../impl/jline/CompleterAsCompletor.java        |  34 -
 .../impl/jline/ConsoleFactoryService.java       |  98 ---
 .../shell/console/impl/jline/ConsoleImpl.java   | 599 -------------
 .../console/impl/jline/DelayedStarted.java      |  87 --
 .../console/impl/jline/KarafFileHistory.java    |  65 --
 .../console/impl/jline/LocalConsoleManager.java | 163 ----
 .../console/impl/jline/StreamWrapUtil.java      |  92 --
 .../console/impl/jline/TerminalFactory.java     |  47 -
 .../karaf/shell/commands/basic/Context.java     |  67 --
 .../shell/commands/basic/SimpleSubShell.java    |  39 -
 .../shell/commands/basic/TestCommands.java      | 184 ----
 .../shell/commands/meta/TestFormatting.java     |  35 -
 .../completer/ArgumentCompleterTest.java        | 145 ----
 .../console/completer/BooleanCompleterTest.java |  62 --
 .../console/completer/CompleterTestSupport.java |  34 -
 .../console/completer/CompleterValuesTest.java  |  74 --
 .../shell/console/completer/CompletionTest.java | 172 ----
 .../console/completer/DummyCommandSession.java  |  48 --
 .../console/completer/FileCompleterTest.java    |  56 --
 .../shell/console/impl/ExampleSubclassMain.java | 104 ---
 .../console/impl/jline/ConsoleImplTest.java     | 195 -----
 .../SecuredCommandConfigTransformerTest.java    | 281 ------
 .../impl/SecuredCommandProcessorImplTest.java   | 142 ----
 shell/core/pom.xml                              |   8 +
 .../karaf/shell/api/console/Candidate.java      |  78 ++
 .../karaf/shell/api/console/Completer.java      |   8 +
 .../apache/karaf/shell/api/console/Session.java |   3 +-
 .../impl/action/command/ActionCommand.java      |   9 +
 .../impl/action/command/ArgumentCompleter.java  |  85 +-
 .../shell/impl/console/CommandsCompleter.java   | 128 ++-
 .../impl/console/CompleterAsCompletor.java      |  51 --
 .../shell/impl/console/ConsoleSessionImpl.java  | 307 ++-----
 .../shell/impl/console/HeadlessSessionImpl.java |   1 +
 .../shell/impl/console/HistoryWrapper.java      |   4 +-
 .../karaf/shell/impl/console/JLineTerminal.java | 246 ++++--
 .../shell/impl/console/KarafFileHistory.java    |  64 --
 .../karaf/shell/impl/console/KarafTerminal.java |  62 +-
 .../shell/impl/console/TerminalFactory.java     |  47 -
 .../help/wikidoc/AnsiPrintingWikiVisitor.java   |  24 +-
 .../shell/impl/console/osgi/Activator.java      |   8 +-
 .../impl/console/osgi/LocalConsoleManager.java  |  16 +-
 .../shell/impl/console/osgi/StreamWrapUtil.java |  91 --
 .../shell/impl/console/standalone/Main.java     |  36 +-
 .../karaf/shell/support/ansi/AnsiSplitter.java  | 382 ++-------
 .../karaf/shell/support/ansi/SimpleAnsi.java    |  16 +-
 .../support/completers/AggregateCompleter.java  |  59 +-
 .../shell/support/completers/FileCompleter.java |   3 +-
 .../karaf/shell/support/table/AnsiColumn.java   |  20 +-
 .../shell/support/terminal/SignalSupport.java   |  20 +-
 .../impl/console/CompleterAsCompletorTest.java  |  60 --
 .../shell/support/ansi/AnsiSplitterTest.java    |   2 +-
 shell/pom.xml                                   |   2 +-
 .../karaf/shell/ssh/ShellFactoryImpl.java       |  60 +-
 .../org/apache/karaf/shell/ssh/SshAction.java   | 181 ++--
 .../org/apache/karaf/shell/ssh/SshTerminal.java | 175 +++-
 .../org/apache/karaf/util/jaas/JaasHelper.java  |   8 +
 webconsole/gogo/pom.xml                         |   5 +-
 .../karaf/webconsole/gogo/GogoPlugin.java       |   9 +-
 .../karaf/webconsole/gogo/WebTerminal.java      |  61 +-
 .../wrapper/internal/WrapperServiceImpl.java    |  30 +-
 88 files changed, 1330 insertions(+), 6095 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/assemblies/apache-karaf-minimal/pom.xml
----------------------------------------------------------------------
diff --git a/assemblies/apache-karaf-minimal/pom.xml b/assemblies/apache-karaf-minimal/pom.xml
index 93b021b..ac20996 100644
--- a/assemblies/apache-karaf-minimal/pom.xml
+++ b/assemblies/apache-karaf-minimal/pom.xml
@@ -139,6 +139,7 @@
                         <feature>service</feature>
                         <feature>system</feature>
                     </bootFeatures>
+                    <javase>1.8</javase>
                 </configuration>
             </plugin>
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/assemblies/apache-karaf/pom.xml
----------------------------------------------------------------------
diff --git a/assemblies/apache-karaf/pom.xml b/assemblies/apache-karaf/pom.xml
index 707d79f..c5b5987 100644
--- a/assemblies/apache-karaf/pom.xml
+++ b/assemblies/apache-karaf/pom.xml
@@ -206,6 +206,7 @@
                         <library>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activator/${servicemix.specs.version};type:=default;export:=true</library>
                         <library>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.locator/${servicemix.specs.version};type:=default;export:=true</library>
                     </libraries>
+                    <javase>1.8</javase>
                 </configuration>
             </plugin>
         </plugins>

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/assemblies/features/framework/pom.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/framework/pom.xml b/assemblies/features/framework/pom.xml
index 42b150e..9f4a19f 100644
--- a/assemblies/features/framework/pom.xml
+++ b/assemblies/features/framework/pom.xml
@@ -85,10 +85,6 @@
             <groupId>jline</groupId>
             <artifactId>jline</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.jledit</groupId>
-            <artifactId>core</artifactId>
-        </dependency>
 
         <!-- listed in source feature.xml with explicit startlevel -->
         <dependency>

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/assemblies/features/standard/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/standard/src/main/feature/feature.xml b/assemblies/features/standard/src/main/feature/feature.xml
index 4447b72..dd260a9 100644
--- a/assemblies/features/standard/src/main/feature/feature.xml
+++ b/assemblies/features/standard/src/main/feature/feature.xml
@@ -101,8 +101,8 @@
             new = admin
             java = admin
         </config>
+        <bundle dependency="true" start-level="30">mvn:org.fusesource.jansi/jansi/${jansi.version}</bundle>
         <bundle dependency="true" start-level="30">mvn:jline/jline/${jline.version}</bundle>
-        <bundle dependency="true" start-level="30">mvn:org.jledit/core/${jledit.version}</bundle>
         <bundle start-level="30">mvn:org.apache.karaf.shell/org.apache.karaf.shell.core/${project.version}</bundle>
         <bundle start-level="30">mvn:org.apache.karaf.shell/org.apache.karaf.shell.commands/${project.version}</bundle>
     </feature>

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java
----------------------------------------------------------------------
diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java
index a79dd58..72d987c 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Classes.java
@@ -21,13 +21,10 @@ import java.util.Collection;
 import org.apache.karaf.shell.api.action.Command;
 import org.apache.karaf.shell.api.action.Option;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.ansi.SimpleAnsi;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.wiring.BundleWiring;
 
-import static org.fusesource.jansi.Ansi.Attribute.INTENSITY_BOLD;
-import static org.fusesource.jansi.Ansi.Attribute.RESET;
-import static org.fusesource.jansi.Ansi.ansi;
-
 @Command(scope = "bundle", name = "classes", description = "Displays a list of classes/resources contained in the bundle")
 @Service
 public class Classes extends BundlesCommand {
@@ -53,7 +50,7 @@ public class Classes extends BundlesCommand {
             }
             for (String resource:resources){
                 if (localResources.contains(resource)) {
-                    System.out.println(ansi().a(INTENSITY_BOLD).a(resource).a(RESET));
+                    System.out.println(SimpleAnsi.INTENSITY_BOLD + resource + SimpleAnsi.INTENSITY_NORMAL);
                 } else {
                     System.out.println(resource);
                 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java
----------------------------------------------------------------------
diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java
index 71ea0bb..1e88696 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Headers.java
@@ -38,7 +38,7 @@ import org.apache.karaf.shell.api.action.lifecycle.Reference;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.apache.karaf.shell.api.console.Terminal;
 import org.apache.karaf.shell.support.ShellUtil;
-import org.fusesource.jansi.Ansi;
+import org.apache.karaf.shell.support.ansi.SimpleAnsi;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.wiring.BundleCapability;
@@ -174,22 +174,21 @@ public class Headers extends BundlesCommand {
         formatters.put(REQUIRE_BUNDLE_ATTRIB, new ClauseFormatter() {
             public void pre(Clause clause, StringBuilder output) {
                 boolean isSatisfied = checkBundle(clause.getName(), clause.getAttribute("bundle-version"));
-                Ansi.ansi(output).fg(isSatisfied ? Ansi.Color.DEFAULT : Ansi.Color.RED).a("");
+                output.append(isSatisfied ? SimpleAnsi.COLOR_DEFAULT : SimpleAnsi.COLOR_RED);
             }
             public void post(Clause clause, StringBuilder output) {
-                Ansi.ansi(output).reset().a("");
+                output.append(SimpleAnsi.RESET);
             }
         });
         formatters.put(IMPORT_PACKAGES_ATTRIB, new ClauseFormatter() {
             public void pre(Clause clause, StringBuilder output) {
                 boolean isSatisfied = checkPackage(clause.getName(), clause.getAttribute("version"));
                 boolean isOptional = "optional".equals(clause.getDirective("resolution"));
-                Ansi.ansi(output).fg(isSatisfied ? Ansi.Color.DEFAULT : Ansi.Color.RED)
-                                 .a(isSatisfied || isOptional ? Ansi.Attribute.INTENSITY_BOLD_OFF : Ansi.Attribute.INTENSITY_BOLD)
-                                 .a("");
+                output.append(isSatisfied ? SimpleAnsi.COLOR_DEFAULT : SimpleAnsi.COLOR_RED);
+                output.append(isSatisfied || isOptional ? SimpleAnsi.INTENSITY_NORMAL : SimpleAnsi.INTENSITY_BOLD);
             }
             public void post(Clause clause, StringBuilder output) {
-                Ansi.ansi(output).reset().a("");
+                output.append(SimpleAnsi.RESET);
             }
         });
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/client/src/main/java/org/apache/karaf/client/Main.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/Main.java b/client/src/main/java/org/apache/karaf/client/Main.java
index 89cb9f4..0d704a2 100644
--- a/client/src/main/java/org/apache/karaf/client/Main.java
+++ b/client/src/main/java/org/apache/karaf/client/Main.java
@@ -16,32 +16,35 @@
  */
 package org.apache.karaf.client;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
 import java.io.Closeable;
-import java.lang.reflect.Field;
+import java.io.Console;
+import java.io.FileInputStream;
+import java.io.FilterInputStream;
+import java.io.IOError;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.InterruptedIOException;
+import java.io.ObjectInputStream;
+import java.io.Reader;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.nio.file.Paths;
 import java.security.KeyPair;
-import java.nio.charset.Charset;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
 
-import jline.NoInterruptUnixTerminal;
-import jline.Terminal;
-import jline.TerminalFactory;
-
-import jline.UnixTerminal;
-import jline.internal.TerminalLineSettings;
 import org.apache.sshd.agent.SshAgent;
 import org.apache.sshd.agent.local.AgentImpl;
 import org.apache.sshd.agent.local.LocalAgentFactory;
@@ -49,27 +52,25 @@ import org.apache.sshd.client.ClientBuilder;
 import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.auth.keyboard.UserInteraction;
 import org.apache.sshd.client.channel.ChannelShell;
-import org.apache.sshd.client.channel.ClientChannelEvent;
-import org.apache.sshd.client.channel.PtyCapableChannelSession;
-import org.apache.sshd.client.future.ConnectFuture;
-import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.NamedFactory;
-import org.apache.sshd.common.RuntimeSshException;
-import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.client.channel.ClientChannel;
+import org.apache.sshd.client.channel.ClientChannelEvent;
 import org.apache.sshd.client.channel.PtyCapableChannelSession;
 import org.apache.sshd.client.future.ConnectFuture;
 import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.RuntimeSshException;
-import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.channel.PtyMode;
-import org.apache.sshd.common.kex.KeyExchange;
 import org.apache.sshd.common.keyprovider.AbstractFileKeyPairProvider;
-import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.SecurityUtils;
-import org.apache.sshd.common.util.buffer.Buffer;
-import org.fusesource.jansi.AnsiConsole;
-import org.fusesource.jansi.internal.CLibrary;
+import org.apache.sshd.common.util.io.NoCloseInputStream;
+import org.jline.terminal.Attributes;
+import org.jline.terminal.Attributes.ControlChar;
+import org.jline.terminal.Attributes.InputFlag;
+import org.jline.terminal.Attributes.LocalFlag;
+import org.jline.terminal.Attributes.OutputFlag;
+import org.jline.terminal.Size;
+import org.jline.terminal.Terminal;
+import org.jline.terminal.TerminalBuilder;
 import org.slf4j.impl.SimpleLogger;
 
 /**
@@ -84,13 +85,10 @@ public class Main {
         if (config.getFile() != null) {
             StringBuilder sb = new StringBuilder();
             sb.setLength(0);
-            Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(config.getFile())));
-            try {
+            try (Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(config.getFile())))) {
                 for (int c = reader.read(); c >= 0; c = reader.read()) {
                     sb.append((char) c);
                 }
-            } finally {
-                reader.close();
             }
             config.setCommand(sb.toString());
         } else if (config.isBatch()) {
@@ -103,13 +101,8 @@ public class Main {
             config.setCommand(sb.toString());
         }
 
-        SshClient client = null;
-        Terminal terminal = null;
-        int exitStatus = 0;
-        try {
-            ClientBuilder clientBuilder = ClientBuilder.builder();
-
-            client = clientBuilder.build();
+        try (SshClient client = ClientBuilder.builder().build())
+        {
             setupAgent(config.getUser(), config.getKeyFile(), client);
             client.getProperties().put(FactoryManager.IDLE_TIMEOUT, String.valueOf(config.getIdleTimeout()));
             final Console console = System.console();
@@ -161,94 +154,90 @@ public class Main {
             }
             session.auth().verify();
 
-            ClientChannel channel;
-            if (config.getCommand().length() > 0) {
-                channel = session.createChannel("exec", config.getCommand() + "\n");
-                channel.setIn(new ByteArrayInputStream(new byte[0]));
-            } else {
-                TerminalFactory.registerFlavor(TerminalFactory.Flavor.UNIX, UnixTerminal.class);
-                terminal = TerminalFactory.create();
-                if (terminal instanceof UnixTerminal) {
-                    TerminalLineSettings settings = ((UnixTerminal) terminal).getSettings();
-                    settings.undef("vlnext");
-                    settings.undef("vintr");
-                }
-                channel = session.createChannel("shell");
-                ConsoleInputStream in = new ConsoleInputStream(terminal.wrapInIfNeeded(System.in));
-                new Thread(in).start();
-                channel.setIn(in);
-                if (terminal instanceof UnixTerminal) {
-                    TerminalLineSettings settings = ((UnixTerminal) terminal).getSettings();
-                    Map<PtyMode, Integer> modes = new HashMap<>();
-                    // Control chars
-                    modes.put(PtyMode.VINTR, settings.getProperty("vintr"));
-                    modes.put(PtyMode.VQUIT, settings.getProperty("vquit"));
-                    modes.put(PtyMode.VERASE, settings.getProperty("verase"));
-                    modes.put(PtyMode.VKILL, settings.getProperty("vkill"));
-                    modes.put(PtyMode.VEOF, settings.getProperty("veof"));
-                    modes.put(PtyMode.VEOL, settings.getProperty("veol"));
-                    modes.put(PtyMode.VEOL2, settings.getProperty("veol2"));
-                    modes.put(PtyMode.VSTART, settings.getProperty("vstart"));
-                    modes.put(PtyMode.VSTOP, settings.getProperty("vstop"));
-                    modes.put(PtyMode.VSUSP, settings.getProperty("vsusp"));
-                    modes.put(PtyMode.VDSUSP, settings.getProperty("vdusp"));
-                    modes.put(PtyMode.VREPRINT, settings.getProperty("vreprint"));
-                    modes.put(PtyMode.VWERASE, settings.getProperty("vwerase"));
-                    modes.put(PtyMode.VLNEXT, settings.getProperty("vlnext"));
-                    modes.put(PtyMode.VSTATUS, settings.getProperty("vstatus"));
-                    modes.put(PtyMode.VDISCARD, settings.getProperty("vdiscard"));
-                    // Input flags
-                    modes.put(PtyMode.IGNPAR, getFlag(settings, PtyMode.IGNPAR));
-                    modes.put(PtyMode.PARMRK, getFlag(settings, PtyMode.PARMRK));
-                    modes.put(PtyMode.INPCK, getFlag(settings, PtyMode.INPCK));
-                    modes.put(PtyMode.ISTRIP, getFlag(settings, PtyMode.ISTRIP));
-                    modes.put(PtyMode.INLCR, getFlag(settings, PtyMode.INLCR));
-                    modes.put(PtyMode.IGNCR, getFlag(settings, PtyMode.IGNCR));
-                    modes.put(PtyMode.ICRNL, getFlag(settings, PtyMode.ICRNL));
-                    modes.put(PtyMode.IXON, getFlag(settings, PtyMode.IXON));
-                    modes.put(PtyMode.IXANY, getFlag(settings, PtyMode.IXANY));
-                    modes.put(PtyMode.IXOFF, getFlag(settings, PtyMode.IXOFF));
-                    // Local flags
-                    modes.put(PtyMode.ISIG, getFlag(settings, PtyMode.ISIG));
-                    modes.put(PtyMode.ICANON, getFlag(settings, PtyMode.ICANON));
-                    modes.put(PtyMode.ECHO, getFlag(settings, PtyMode.ECHO));
-                    modes.put(PtyMode.ECHOE, getFlag(settings, PtyMode.ECHOE));
-                    modes.put(PtyMode.ECHOK, getFlag(settings, PtyMode.ECHOK));
-                    modes.put(PtyMode.ECHONL, getFlag(settings, PtyMode.ECHONL));
-                    modes.put(PtyMode.NOFLSH, getFlag(settings, PtyMode.NOFLSH));
-                    modes.put(PtyMode.TOSTOP, getFlag(settings, PtyMode.TOSTOP));
-                    modes.put(PtyMode.IEXTEN, getFlag(settings, PtyMode.IEXTEN));
-                    // Output flags
-                    modes.put(PtyMode.OPOST, getFlag(settings, PtyMode.OPOST));
-                    modes.put(PtyMode.OLCUC, getFlag(settings, PtyMode.OLCUC));
-                    modes.put(PtyMode.ONLCR, getFlag(settings, PtyMode.ONLCR));
-                    modes.put(PtyMode.OCRNL, getFlag(settings, PtyMode.OCRNL));
-                    modes.put(PtyMode.ONOCR, getFlag(settings, PtyMode.ONOCR));
-                    modes.put(PtyMode.ONLRET, getFlag(settings, PtyMode.ONLRET));
-                    ((ChannelShell) channel).setPtyModes(modes);
-                } else {
-                    ((ChannelShell) channel).setupSensibleDefaultPty();
-                }
-                ((ChannelShell) channel).setPtyColumns(terminal.getWidth());
-                ((ChannelShell) channel).setPtyLines(terminal.getHeight());
-                ((ChannelShell) channel).setAgentForwarding(true);
-                String ctype = System.getenv("LC_CTYPE");
-                if (ctype == null) {
-                    ctype = Locale.getDefault().toString() + "."
-                            + System.getProperty("input.encoding", Charset.defaultCharset().name());
+            int exitStatus = 0;
+            try (Terminal terminal = TerminalBuilder.terminal()) {
+                Attributes attributes = terminal.enterRawMode();
+                try {
+                    ClientChannel channel;
+                    if (config.getCommand().length() > 0) {
+                        channel = session.createChannel("exec", config.getCommand() + "\n");
+                        channel.setIn(new ByteArrayInputStream(new byte[0]));
+                    } else {
+                        ChannelShell shell = session.createShellChannel();
+                        channel = shell;
+                        channel.setIn(new NoCloseInputStream(terminal.input()));
+
+                        Map<PtyMode, Integer> modes = new HashMap<>();
+                        // Control chars
+                        modes.put(PtyMode.VINTR, attributes.getControlChar(ControlChar.VINTR));
+                        modes.put(PtyMode.VQUIT, attributes.getControlChar(ControlChar.VQUIT));
+                        modes.put(PtyMode.VERASE, attributes.getControlChar(ControlChar.VERASE));
+                        modes.put(PtyMode.VKILL, attributes.getControlChar(ControlChar.VKILL));
+                        modes.put(PtyMode.VEOF, attributes.getControlChar(ControlChar.VEOF));
+                        modes.put(PtyMode.VEOL, attributes.getControlChar(ControlChar.VEOL));
+                        modes.put(PtyMode.VEOL2, attributes.getControlChar(ControlChar.VEOL2));
+                        modes.put(PtyMode.VSTART, attributes.getControlChar(ControlChar.VSTART));
+                        modes.put(PtyMode.VSTOP, attributes.getControlChar(ControlChar.VSTOP));
+                        modes.put(PtyMode.VSUSP, attributes.getControlChar(ControlChar.VSUSP));
+                        modes.put(PtyMode.VDSUSP, attributes.getControlChar(ControlChar.VDSUSP));
+                        modes.put(PtyMode.VREPRINT, attributes.getControlChar(ControlChar.VREPRINT));
+                        modes.put(PtyMode.VWERASE, attributes.getControlChar(ControlChar.VWERASE));
+                        modes.put(PtyMode.VLNEXT, attributes.getControlChar(ControlChar.VLNEXT));
+                        modes.put(PtyMode.VSTATUS, attributes.getControlChar(ControlChar.VSTATUS));
+                        modes.put(PtyMode.VDISCARD, attributes.getControlChar(ControlChar.VDISCARD));
+                        // Input flags
+                        modes.put(PtyMode.IGNPAR, getFlag(attributes, InputFlag.IGNPAR));
+                        modes.put(PtyMode.PARMRK, getFlag(attributes, InputFlag.PARMRK));
+                        modes.put(PtyMode.INPCK, getFlag(attributes, InputFlag.INPCK));
+                        modes.put(PtyMode.ISTRIP, getFlag(attributes, InputFlag.ISTRIP));
+                        modes.put(PtyMode.INLCR, getFlag(attributes, InputFlag.INLCR));
+                        modes.put(PtyMode.IGNCR, getFlag(attributes, InputFlag.IGNCR));
+                        modes.put(PtyMode.ICRNL, getFlag(attributes, InputFlag.ICRNL));
+                        modes.put(PtyMode.IXON, getFlag(attributes, InputFlag.IXON));
+                        modes.put(PtyMode.IXANY, getFlag(attributes, InputFlag.IXANY));
+                        modes.put(PtyMode.IXOFF, getFlag(attributes, InputFlag.IXOFF));
+                        // Local flags
+                        modes.put(PtyMode.ISIG, getFlag(attributes, LocalFlag.ISIG));
+                        modes.put(PtyMode.ICANON, getFlag(attributes, LocalFlag.ICANON));
+                        modes.put(PtyMode.ECHO, getFlag(attributes, LocalFlag.ECHO));
+                        modes.put(PtyMode.ECHOE, getFlag(attributes, LocalFlag.ECHOE));
+                        modes.put(PtyMode.ECHOK, getFlag(attributes, LocalFlag.ECHOK));
+                        modes.put(PtyMode.ECHONL, getFlag(attributes, LocalFlag.ECHONL));
+                        modes.put(PtyMode.NOFLSH, getFlag(attributes, LocalFlag.NOFLSH));
+                        modes.put(PtyMode.TOSTOP, getFlag(attributes, LocalFlag.TOSTOP));
+                        modes.put(PtyMode.IEXTEN, getFlag(attributes, LocalFlag.IEXTEN));
+                        // Output flags
+                        modes.put(PtyMode.OPOST, getFlag(attributes, OutputFlag.OPOST));
+                        modes.put(PtyMode.ONLCR, getFlag(attributes, OutputFlag.ONLCR));
+                        modes.put(PtyMode.OCRNL, getFlag(attributes, OutputFlag.OCRNL));
+                        modes.put(PtyMode.ONOCR, getFlag(attributes, OutputFlag.ONOCR));
+                        modes.put(PtyMode.ONLRET, getFlag(attributes, OutputFlag.ONLRET));
+                        shell.setPtyModes(modes);
+                        shell.setPtyColumns(terminal.getWidth());
+                        shell.setPtyLines(terminal.getHeight());
+                        shell.setAgentForwarding(true);
+                        String ctype = System.getenv("LC_CTYPE");
+                        if (ctype == null) {
+                            ctype = Locale.getDefault().toString() + "."
+                                    + System.getProperty("input.encoding", Charset.defaultCharset().name());
+                        }
+                        shell.setEnv("LC_CTYPE", ctype);
+                    }
+                    channel.setOut(terminal.output());
+                    channel.setErr(terminal.output());
+                    channel.open().verify();
+                    if (channel instanceof PtyCapableChannelSession) {
+                        registerSignalHandler(terminal, (PtyCapableChannelSession) channel);
+                    }
+                    channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), 0);
+                    if (channel.getExitStatus() != null) {
+                        exitStatus = channel.getExitStatus();
+                    }
+                } finally {
+                    terminal.setAttributes(attributes);
                 }
-                ((ChannelShell) channel).setEnv("LC_CTYPE", ctype);
-            }
-            channel.setOut(AnsiConsole.wrapOutputStream(System.out));
-            channel.setErr(AnsiConsole.wrapOutputStream(System.err));
-            channel.open().verify();
-            if (channel instanceof PtyCapableChannelSession) {
-                registerSignalHandler(terminal, (PtyCapableChannelSession) channel);
-            }
-            channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), 0);
-            if (channel.getExitStatus() != null) {
-                exitStatus = channel.getExitStatus();
             }
+            System.exit(exitStatus);
         } catch (Throwable t) {
             if (config.getLevel() > SimpleLogger.WARN) {
                 t.printStackTrace();
@@ -256,24 +245,19 @@ public class Main {
                 System.err.println(t.getMessage());
             }
             System.exit(1);
-        } finally {
-            try {
-                client.stop();
-            } catch (Throwable t) {
-            }
-            try {
-                if (terminal != null) {
-                    terminal.restore();
-                }
-            } catch (Throwable t) {
-            }
         }
-        System.exit(exitStatus);
     }
 
-    private static int getFlag(TerminalLineSettings settings, PtyMode mode) {
-        String name = mode.toString().toLowerCase();
-        return (settings.getPropertyAsString(name) != null) ? 1 : 0;
+    private static int getFlag(Attributes attributes, InputFlag flag) {
+        return attributes.getInputFlag(flag) ? 1 : 0;
+    }
+
+    private static int getFlag(Attributes attributes, OutputFlag flag) {
+        return attributes.getOutputFlag(flag) ? 1 : 0;
+    }
+
+    private static int getFlag(Attributes attributes, LocalFlag flag) {
+        return attributes.getLocalFlag(flag) ? 1 : 0;
     }
 
     private static void setupAgent(String user, String keyFile, SshClient client) {
@@ -338,24 +322,6 @@ public class Main {
         }
     }
 
-    private static String readLine(String msg) throws IOException {
-        StringBuffer sb = new StringBuffer();
-        System.err.print(msg);
-        System.err.flush();
-        for (; ; ) {
-            int c = System.in.read();
-            if (c < 0) {
-                return null;
-            }
-            System.err.print((char) c);
-            if (c == '\r' || c == '\n') {
-                break;
-            }
-            sb.append((char) c);
-        }
-        return sb.toString();
-    }
-
     private static void registerSignalHandler(final Terminal terminal, final PtyCapableChannelSession channel) {
         try {
             Class<?> signalClass = Class.forName("sun.misc.Signal");
@@ -364,36 +330,18 @@ public class Main {
             Object signalHandler = Proxy.newProxyInstance(Main.class.getClassLoader(),
                     new Class<?>[]{signalHandlerClass}, new InvocationHandler() {
                         public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-                            // Ugly hack to force the jline unix terminal to retrieve the width/height of the terminal
-                            // because results are cached for 1 second.
-                            try {
-                                Field field = terminal.getClass().getSuperclass().getDeclaredField("settings");
-                                field.setAccessible(true);
-                                Object settings = field.get(terminal);
-                                field = settings.getClass().getDeclaredField("configLastFetched");
-                                field.setAccessible(true);
-                                field.setLong(settings, 0L);
-                            } catch (Throwable t) {
-                                // Ignore
-                            }
-                            // TODO: replace with PtyCapableChannelSession#sendWindowChange
-                            Session session = channel.getSession();
-                            Buffer buffer = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_REQUEST);
-                            buffer.putInt(channel.getRecipient());
-                            buffer.putString("window-change");
-                            buffer.putBoolean(false);
-                            buffer.putInt(terminal.getWidth());
-                            buffer.putInt(terminal.getHeight());
-                            buffer.putInt(0);
-                            buffer.putInt(0);
-                            session.writePacket(buffer);
+                            Size size = terminal.getSize();
+                            channel.sendWindowChange(size.getColumns(), size.getRows());
                             return null;
                         }
                     }
             );
             // Register the signal handler, this code is equivalent to:
             // Signal.handle(new Signal("CONT"), signalHandler);
-            signalClass.getMethod("handle", signalClass, signalHandlerClass).invoke(null, signalClass.getConstructor(String.class).newInstance("WINCH"), signalHandler);
+            signalClass.getMethod("handle", signalClass, signalHandlerClass).invoke(
+                    null,
+                    signalClass.getConstructor(String.class).newInstance("WINCH"),
+                    signalHandler);
         } catch (Exception e) {
             // Ignore this exception, if the above failed, the signal API is incompatible with what we're expecting
 
@@ -408,101 +356,14 @@ public class Main {
             Object signalHandler = signalHandlerClass.getField("SIG_DFL").get(null);
             // Register the signal handler, this code is equivalent to:
             // Signal.handle(new Signal("CONT"), signalHandler);
-            signalClass.getMethod("handle", signalClass, signalHandlerClass).invoke(null, signalClass.getConstructor(String.class).newInstance("WINCH"), signalHandler);
+            signalClass.getMethod("handle", signalClass, signalHandlerClass).invoke(
+                    null,
+                    signalClass.getConstructor(String.class).newInstance("WINCH"),
+                    signalHandler);
         } catch (Exception e) {
             // Ignore this exception, if the above failed, the signal API is incompatible with what we're expecting
 
         }
     }
 
-    private static class ConsoleInputStream extends InputStream implements Runnable {
-
-        private InputStream in;
-        private boolean eof = false;
-        private final BlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(1024);
-
-        public ConsoleInputStream(InputStream in) {
-            this.in = in;
-        }
-
-        private int read(boolean wait) throws IOException {
-            if (eof && queue.isEmpty()) {
-                return -1;
-            }
-            Integer i;
-            if (wait) {
-                try {
-                    i = queue.take();
-                } catch (InterruptedException e) {
-                    throw new InterruptedIOException();
-                }
-            } else {
-                i = queue.poll();
-            }
-            if (i == null) {
-                return -1;
-            }
-            return i;
-        }
-
-        @Override
-        public int read() throws IOException {
-            return read(true);
-        }
-
-        @Override
-        public int read(byte b[], int off, int len) throws IOException {
-            if (b == null) {
-                throw new NullPointerException();
-            } else if (off < 0 || len < 0 || len > b.length - off) {
-                throw new IndexOutOfBoundsException();
-            } else if (len == 0) {
-                return 0;
-            }
-
-            int nb = 1;
-            int i = read(true);
-            if (i < 0) {
-                return -1;
-            }
-            b[off++] = (byte) i;
-            while (nb < len) {
-                i = read(false);
-                if (i < 0) {
-                    return nb;
-                }
-                b[off++] = (byte) i;
-                nb++;
-            }
-            return nb;
-        }
-
-        @Override
-        public int available() throws IOException {
-            return queue.size();
-        }
-
-        public void run() {
-            try {
-                while (true) {
-                    try {
-                        int c = in.read();
-                        if (c == -1) {
-                            return;
-                        }
-                        queue.put(c);
-                    } catch (Throwable t) {
-                        return;
-                    }
-                }
-            } finally {
-                eof = true;
-                try {
-                    queue.put(-1);
-                } catch (InterruptedException e) {
-                }
-            }
-        }
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/demos/profiles/registry/pom.xml
----------------------------------------------------------------------
diff --git a/demos/profiles/registry/pom.xml b/demos/profiles/registry/pom.xml
index 8e55551..74e030d 100644
--- a/demos/profiles/registry/pom.xml
+++ b/demos/profiles/registry/pom.xml
@@ -34,7 +34,7 @@
 
     <properties>
         <activemq.version>5.11.1</activemq.version>
-        <camel.version>2.15.2</camel.version>
+        <camel.version>2.16.2</camel.version>
         <cxf.version>3.1.0</cxf.version>
     </properties>
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java
----------------------------------------------------------------------
diff --git a/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java b/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java
index e4f9854..2e71ff7 100644
--- a/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java
+++ b/features/command/src/main/java/org/apache/karaf/features/command/completers/FeatureCompleterSupport.java
@@ -16,16 +16,16 @@
  */
 package org.apache.karaf.features.command.completers;
 
+import java.util.ArrayList;
 import java.util.List;
-import java.util.SortedSet;
 
 import org.apache.karaf.features.Feature;
 import org.apache.karaf.features.FeaturesService;
 import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.console.Candidate;
 import org.apache.karaf.shell.api.console.CommandLine;
 import org.apache.karaf.shell.api.console.Completer;
 import org.apache.karaf.shell.api.console.Session;
-import org.apache.karaf.shell.support.completers.StringsCompleter;
 
 /**
  * Base completer for feature commands.
@@ -42,22 +42,33 @@ public abstract class FeatureCompleterSupport implements Completer {
         this.featuresService = featuresService;
     }
 
+    @Override
     public int complete(Session session, final CommandLine commandLine, final List<String> candidates) {
-        StringsCompleter delegate = new StringsCompleter();
+        List<Candidate> cands = new ArrayList<>();
+        completeCandidates(session, commandLine, cands);
+        for (Candidate cand : cands) {
+            candidates.add(cand.value());
+        }
+        return candidates.isEmpty() ? -1 : 0;
+    }
+
+    @Override
+    public void completeCandidates(Session session, CommandLine commandLine, List<Candidate> candidates) {
         try {
             for (Feature feature : featuresService.listFeatures()) {
                 if (acceptsFeature(feature)) {
-                    add(delegate.getStrings(), feature);
+                    add(candidates, feature);
                 }
             }
         } catch (Exception e) {
             // Ignore
         }
-        return delegate.complete(session, commandLine, candidates);
     }
 
-    protected void add(SortedSet<String> candidates, Feature feature) {
-        candidates.add(feature.getName());
+    protected void add(List<Candidate> candidates, Feature feature) {
+        candidates.add(new Candidate(
+                feature.getName(), feature.getName(), null,
+                feature.getDescription(), null, null, true));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
----------------------------------------------------------------------
diff --git a/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java b/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
index 6372b8a..5a3c03b 100644
--- a/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
+++ b/instance/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
@@ -52,9 +52,9 @@ import org.apache.karaf.jpm.impl.ScriptUtils;
 import org.apache.karaf.profile.Profile;
 import org.apache.karaf.profile.ProfileBuilder;
 import org.apache.karaf.profile.ProfileService;
+import org.apache.karaf.shell.support.ansi.SimpleAnsi;
 import org.apache.karaf.util.StreamUtils;
 import org.apache.karaf.util.locks.FileLockUtils;
-import org.fusesource.jansi.Ansi;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceReference;
@@ -680,10 +680,10 @@ public class InstanceServiceImpl implements InstanceService {
                     throw new IllegalStateException("Instance not stopped");
                 }
 
-                println(Ansi.ansi().a("Renaming instance ")
-                        .a(Ansi.Attribute.INTENSITY_BOLD).a(oldName).a(Ansi.Attribute.RESET)
-                        .a(" to ")
-                        .a(Ansi.Attribute.INTENSITY_BOLD).a(newName).a(Ansi.Attribute.RESET).toString());
+                println("Renaming instance "
+                        + SimpleAnsi.INTENSITY_BOLD + oldName + SimpleAnsi.INTENSITY_NORMAL
+                        + " to "
+                        + SimpleAnsi.INTENSITY_BOLD + newName + SimpleAnsi.INTENSITY_NORMAL);
                 // rename directory
                 String oldLocationPath = instance.loc;
                 File oldLocation = new File(oldLocationPath);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/instance/src/main/java/org/apache/karaf/instance/main/Execute.java
----------------------------------------------------------------------
diff --git a/instance/src/main/java/org/apache/karaf/instance/main/Execute.java b/instance/src/main/java/org/apache/karaf/instance/main/Execute.java
index d94276a..c96e62b 100644
--- a/instance/src/main/java/org/apache/karaf/instance/main/Execute.java
+++ b/instance/src/main/java/org/apache/karaf/instance/main/Execute.java
@@ -41,7 +41,6 @@ import org.apache.karaf.instance.core.internal.InstanceServiceImpl;
 import org.apache.karaf.shell.api.action.Action;
 import org.apache.karaf.shell.api.action.Command;
 import org.apache.karaf.shell.impl.action.command.DefaultActionPreparator;
-import org.fusesource.jansi.AnsiConsole;
 
 public class Execute {
     static Class<? extends Action> x = CreateCommand.class;
@@ -87,8 +86,6 @@ public class Execute {
     private static final String PROP_KARAF_OPTS = "karaf.opts";
 
     public static void main(String[] args) throws Exception {
-        AnsiConsole.systemInstall();
-
         if (args.length == 0) {
             listCommands();
             exit(0);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java b/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
index 862cc2d..916a00c 100644
--- a/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
+++ b/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
@@ -99,7 +99,7 @@ public class FeatureTest extends KarafTestSupport {
     public void repoAddRemoveCommandWithRegex() throws Exception {
         System.out.println(executeCommand("feature:repo-add mvn:org.apache.karaf.cellar/apache-karaf-cellar/3.0.0/xml/features"));
         assertContains("apache-karaf-cellar", executeCommand("feature:repo-list"));
-        System.out.println(executeCommand("feature:repo-remove .*apache-karaf-cellar.*"));
+        System.out.println(executeCommand("feature:repo-remove '.*apache-karaf-cellar.*'"));
         assertContainsNot("apache-karaf-cellar", executeCommand("feature:repo-list"));
     }
 
@@ -121,7 +121,7 @@ public class FeatureTest extends KarafTestSupport {
 
     @Test
     public void repoRefreshCommand() throws Exception {
-        String refreshedRepo = executeCommand("feature:repo-refresh .*pax.*");
+        String refreshedRepo = executeCommand("feature:repo-refresh '.*pax.*'");
         assertContains("pax-cdi", refreshedRepo);
         assertContains("pax-web", refreshedRepo);
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/main/pom.xml
----------------------------------------------------------------------
diff --git a/main/pom.xml b/main/pom.xml
index 402739b..c204582 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -43,7 +43,7 @@
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
             <scope>provided</scope>
-        </dependency>    
+        </dependency>
 
         <dependency>
             <groupId>org.ops4j.pax.tinybundles</groupId>

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c75a580..188678d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -185,7 +185,8 @@
         <felix.fileinstall.version>3.5.4</felix.fileinstall.version>
         <felix.framework.version>5.5.0-SNAPSHOT</felix.framework.version>
         <felix.framework.security.version>2.4.0</felix.framework.security.version>
-        <felix.gogo.version>0.16.2</felix.gogo.version>
+        <felix.gogo.runtime.version>0.17.0-SNAPSHOT</felix.gogo.runtime.version>
+        <felix.gogo.jline.version>0.1.0-SNAPSHOT</felix.gogo.jline.version>
         <felix.inventory.version>1.0.4</felix.inventory.version>
         <felix.plugin.version>3.0.1</felix.plugin.version>
         <felix.utils.version>1.8.2</felix.utils.version>
@@ -247,10 +248,9 @@
         <hibernate42.version>4.2.15.Final</hibernate42.version>
         <hibernate43.version>4.3.6.Final</hibernate43.version>
         <hibernate.validator.version>5.2.4.Final</hibernate.validator.version>
-        <jansi.version>1.11</jansi.version>
+        <jansi.version>1.12</jansi.version>
         <javassist.version>3.9.0.GA</javassist.version>
-        <jline.version>2.14.2</jline.version>
-        <jledit.version>0.2.1</jledit.version>
+        <jline.version>3.0.0.M1</jline.version>
         <jsw.version>3.2.3</jsw.version>
         <log4j.version>1.2.17</log4j.version>
         <maven.version>2.0.9</maven.version>
@@ -1188,26 +1188,14 @@
                 <version>${log4j.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.fusesource.jansi</groupId>
+                <artifactId>jansi</artifactId>
+                <version>${jansi.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>jline</groupId>
                 <artifactId>jline</artifactId>
                 <version>${jline.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.fusesource.jansi</groupId>
-                        <artifactId>jansi</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.jledit</groupId>
-                <artifactId>core</artifactId>
-                <version>${jledit.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.fusesource.jansi</groupId>
-                        <artifactId>jansi</artifactId>
-                    </exclusion>
-                </exclusions>
             </dependency>
             <dependency>
                 <groupId>org.apache.maven.artifact</groupId>
@@ -1645,12 +1633,12 @@
             <dependency>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>org.apache.felix.gogo.runtime</artifactId>
-                <version>${felix.gogo.version}</version>
+                <version>${felix.gogo.runtime.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.felix</groupId>
-                <artifactId>org.apache.felix.gogo.commands</artifactId>
-                <version>${felix.gogo.version}</version>
+                <artifactId>org.apache.felix.gogo.jline</artifactId>
+                <version>${felix.gogo.jline.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.ops4j.pax.web</groupId>

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/profile/pom.xml
----------------------------------------------------------------------
diff --git a/profile/pom.xml b/profile/pom.xml
index 7979c2a..3c1f021 100644
--- a/profile/pom.xml
+++ b/profile/pom.xml
@@ -133,12 +133,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.jledit</groupId>
-            <artifactId>core</artifactId>
-            <optional>true</optional>
-        </dependency>
-
-        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-jdk14</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java b/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java
index 525ef38..84b7b66 100644
--- a/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java
+++ b/profile/src/main/java/org/apache/karaf/profile/command/ProfileEdit.java
@@ -26,7 +26,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import jline.TerminalSupport;
 import org.apache.karaf.profile.Profile;
 import org.apache.karaf.profile.ProfileBuilder;
 import org.apache.karaf.profile.ProfileService;
@@ -37,10 +36,6 @@ import org.apache.karaf.shell.api.action.Option;
 import org.apache.karaf.shell.api.action.lifecycle.Reference;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.apache.karaf.shell.api.console.Terminal;
-import org.jledit.ConsoleEditor;
-import org.jledit.ContentManager;
-import org.jledit.EditorFactory;
-import org.jledit.simple.SimpleConsoleEditor;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.slf4j.Logger;
@@ -131,16 +126,8 @@ public class ProfileEdit implements Action {
     private ConfigurationAdmin configurationAdmin;
 
     @Reference
-    private EditorFactory editorFactory;
-
-    @Reference
     Terminal terminal;
 
-    public void init() {
-        // TODO: Karaf 2.4 has a bug to lookup this class, so we bind it manually - Karaf 2.4.1 should have this fixed
-        this.editorFactory.bind("simple", SimpleConsoleEditor.class);
-    }
-
     @Override
     public Object execute() throws Exception {
         if (delete) {
@@ -425,12 +412,14 @@ public class ProfileEdit implements Action {
         String id = profile.getId();
         String location = id + " " + resource;
         //Call the editor
+        /* TODO:JLINE
         ConsoleEditor editor = editorFactory.create("simple", getTerminal());
         editor.setTitle("Profile");
         editor.setOpenEnabled(false);
         editor.setContentManager(new DatastoreContentManager(profileService));
         editor.open(location, id);
         editor.start();
+        */
     }
 
     public void updatedDelimitedList(Map<String, String> map, String key, String value, String delimiter, boolean set, boolean delete, boolean append, boolean remove) {
@@ -515,8 +504,6 @@ public class ProfileEdit implements Action {
     }
 
     /**
-     * Gets the {@link jline.Terminal} from the current session.
-     */
     private jline.Terminal getTerminal() throws Exception {
         try {
             return (jline.Terminal) terminal.getClass().getMethod("getTerminal").invoke(terminal);
@@ -535,10 +522,6 @@ public class ProfileEdit implements Action {
         }
     }
 
-    private Map<String, String> getConfigurationFromBuilder(ProfileBuilder builder, String pid) {
-        return builder.getConfiguration(pid);
-    }
-
     static class DatastoreContentManager implements ContentManager {
 
         private static final Charset UTF_8 = Charset.forName("UTF-8");
@@ -549,9 +532,6 @@ public class ProfileEdit implements Action {
             this.profileService = profileService;
         }
 
-        /**
-         * Loads content from the specified location.
-         */
         @Override
         public String load(String location) throws IOException {
             try {
@@ -569,9 +549,6 @@ public class ProfileEdit implements Action {
             }
         }
 
-        /**
-         * Saves content to the specified location.
-         */
         @Override
         public boolean save(String content, String location) {
             try {
@@ -591,20 +568,20 @@ public class ProfileEdit implements Action {
             return true;
         }
 
-        /**
-         * Saves the {@link String} content to the specified location using the specified {@link java.nio.charset.Charset}.
-         */
         @Override
         public boolean save(String content, Charset charset, String location) {
             return save(content, location);
         }
 
-        /**
-         * Detect the Charset of the content in the specified location.
-         */
         @Override
         public Charset detectCharset(String location) {
             return UTF_8;
         }
     }
+        */
+
+    private Map<String, String> getConfigurationFromBuilder(ProfileBuilder builder, String pid) {
+        return builder.getConfiguration(pid);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/shell/commands/pom.xml
----------------------------------------------------------------------
diff --git a/shell/commands/pom.xml b/shell/commands/pom.xml
index eb2206b..8efaa85 100644
--- a/shell/commands/pom.xml
+++ b/shell/commands/pom.xml
@@ -43,10 +43,6 @@
             <artifactId>org.apache.karaf.shell.core</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.jledit</groupId>
-            <artifactId>core</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.karaf</groupId>
             <artifactId>org.apache.karaf.util</artifactId>
             <scope>provided</scope>
@@ -110,9 +106,6 @@
                         <Bundle-Activator>
                             org.apache.karaf.shell.commands.impl.info.Activator
                         </Bundle-Activator>
-                        <Require-Capability>
-                            osgi.service;filter:="(objectClass=org.jledit.EditorFactory)";effective:=active
-                        </Require-Capability>
                     </instructions>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java
index c201ab0..880ae43 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java
@@ -49,56 +49,83 @@ public class DateAction implements Action {
             }
         }
         if (format == null) {
-            System.out.println(d);
-        } else {
-            // transform Unix format to Java SimpleDateFormat (if required)
-            format = format.replaceAll("%a","EEE");
-            format = format.replaceAll("%A", "EEEEEEE");
-            format = format.replaceAll("%b", "MMM");
-            format = format.replaceAll("%B", "MMMMMMM");
-            format = format.replaceAll("%c", "MMM EEE d HH:mm:ss yyyy");
-            format = format.replaceAll("%C","yy");
-            format = format.replaceAll("%d", "dd");
-            format = format.replaceAll("%D", "MM/dd/yy");
-            format = format.replaceAll("%e", "dd");
-            format = format.replaceAll("%F", "yyyy-MM-dd");
-            format = format.replaceAll("%g", "YY");
-            format = format.replaceAll("%G", "YYYY");
-            format = format.replaceAll("%h", "MMM");
-            format = format.replaceAll("%H", "HH");
-            format = format.replaceAll("%I", "hh");
-            format = format.replaceAll("%j", "DDD");
-            format = format.replaceAll("%k", "HH");
-            format = format.replaceAll("%l", "hh");
-            format = format.replaceAll("%m", "MM");
-            format = format.replaceAll("%M", "mm");
-            format = format.replaceAll("%n", "\n");
-            format = format.replaceAll("%N", "S");
-            format = format.replaceAll("%p", "aa");
-            format = format.replaceAll("%P", "aa");
-            format = format.replaceAll("%r", "hh:mm:ss aa");
-            format = format.replaceAll("%R", "HH:mm");
-            format = format.replaceAll("%s", "S");
-            format = format.replaceAll("%S", "ss");
-            format = format.replaceAll("%t", "\t");
-            format = format.replaceAll("%T", "HH:mm:ss");
-            format = format.replaceAll("%u", "u");
-            format = format.replaceAll("%U", "w");
-            format = format.replaceAll("%V", "W");
-            format = format.replaceAll("%w", "u");
-            format = format.replaceAll("%W", "w");
-            format = format.replaceAll("%x", "MM/dd/yy");
-            format = format.replaceAll("%X", "HH:mm:ss");
-            format = format.replaceAll("%y", "yy");
-            format = format.replaceAll("%Y", "yyyy");
-            format = format.replaceAll("%z", "X");
-            format = format.replaceAll("%:z", "XXX");
-            format = format.replaceAll("%::z", "XXXX");
-            format = format.replaceAll("%:::z", "XXXX");
-            format = format.replaceAll("%Z", "z");
-            DateFormat df = new SimpleDateFormat(format);
-            System.out.println(df.format(d));
+            format = "%+";
+        }
+        // transform Unix format to Java SimpleDateFormat (if required)
+        StringBuilder sb = new StringBuilder();
+        boolean quote = false;
+        for (int i = 0; i < format.length(); i++) {
+            char c = format.charAt(i);
+            if (c == '%') {
+                if (i + 1 < format.length()) {
+                    if (quote) {
+                        sb.append('\'');
+                        quote = false;
+                    }
+                    c = format.charAt(++i);
+                    switch (c) {
+                        case '+':
+                        case 'A': sb.append("MMM EEE d HH:mm:ss yyyy"); break;
+                        case 'a': sb.append("EEE"); break;
+                        case 'B': sb.append("MMMMMMM"); break;
+                        case 'b': sb.append("MMM"); break;
+                        case 'C': sb.append("yy"); break;
+                        case 'c': sb.append("MMM EEE d HH:mm:ss yyyy"); break;
+                        case 'D': sb.append("MM/dd/yy"); break;
+                        case 'd': sb.append("dd"); break;
+                        case 'e': sb.append("dd"); break;
+                        case 'F': sb.append("yyyy-MM-dd"); break;
+                        case 'G': sb.append("YYYY"); break;
+                        case 'g': sb.append("YY"); break;
+                        case 'H': sb.append("HH"); break;
+                        case 'h': sb.append("MMM"); break;
+                        case 'I': sb.append("hh"); break;
+                        case 'j': sb.append("DDD"); break;
+                        case 'k': sb.append("HH"); break;
+                        case 'l': sb.append("hh"); break;
+                        case 'M': sb.append("mm"); break;
+                        case 'm': sb.append("MM"); break;
+                        case 'N': sb.append("S"); break;
+                        case 'n': sb.append("\n"); break;
+                        case 'P': sb.append("aa"); break;
+                        case 'p': sb.append("aa"); break;
+                        case 'r': sb.append("hh:mm:ss aa"); break;
+                        case 'R': sb.append("HH:mm"); break;
+                        case 'S': sb.append("ss"); break;
+                        case 's': sb.append("S"); break;
+                        case 'T': sb.append("HH:mm:ss"); break;
+                        case 't': sb.append("\t"); break;
+                        case 'U': sb.append("w"); break;
+                        case 'u': sb.append("u"); break;
+                        case 'V': sb.append("W"); break;
+                        case 'v': sb.append("dd-MMM-yyyy"); break;
+                        case 'W': sb.append("w"); break;
+                        case 'w': sb.append("u"); break;
+                        case 'X': sb.append("HH:mm:ss"); break;
+                        case 'x': sb.append("MM/dd/yy"); break;
+                        case 'Y': sb.append("yyyy"); break;
+                        case 'y': sb.append("yy"); break;
+                        case 'Z': sb.append("z"); break;
+                        case 'z': sb.append("X"); break;
+                        case '%': sb.append("%"); break;
+                    }
+                } else {
+                    if (!quote) {
+                        sb.append('\'');
+                    }
+                    sb.append(c);
+                    sb.append('\'');
+                }
+            } else {
+                if ((c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z') && !quote) {
+                    sb.append('\'');
+                    quote = true;
+                }
+                sb.append(c);
+            }
         }
+        DateFormat df = new SimpleDateFormat(sb.toString());
+        System.out.println(df.format(d));
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java
index f310949..84feb70 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java
@@ -16,27 +16,18 @@
  */
 package org.apache.karaf.shell.commands.impl;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.UUID;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
 import java.util.regex.Pattern;
 
-import jline.TerminalSupport;
 import org.apache.karaf.shell.api.action.Action;
 import org.apache.karaf.shell.api.action.Argument;
 import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.console.Terminal;
 import org.apache.karaf.shell.api.action.lifecycle.Reference;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.util.StreamUtils;
-import org.jledit.ConsoleEditor;
-import org.jledit.EditorFactory;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.api.console.Terminal;
 
 @Command(scope = "shell", name = "edit", description = "Calls a text editor.")
 @Service
@@ -44,137 +35,21 @@ public class EditAction implements Action {
 
     private final Pattern URL_PATTERN = Pattern.compile("[^: ]+:[^ ]+");
 
-    @Argument(index = 0, name = "url", description = "The url of the resource to edit.", required = true, multiValued = false)
-    private String url;
+    @Argument(index = 0, name = "url", description = "The url of the resource to edit.", required = true, multiValued = true)
+    private List<String> urls;
 
     @Reference
-    private EditorFactory editorFactory;
+    Session session;
 
     @Reference
     Terminal terminal;
 
     @Override
     public Object execute() throws Exception {
-        URLConnection connection = null;
-        InputStream is = null;
-        OutputStream os = null;
-        String path = null;
-        boolean isLocal = true;
-        String sourceUrl = url;
-
-        // if no url format found, assume file url
-        if (!URL_PATTERN.matcher(sourceUrl).matches()) {
-            File f = new File(sourceUrl);
-            sourceUrl = "file://" + f.getAbsolutePath();
-        }
-
-        URL u = new URL(sourceUrl);
-        // if its not a file url
-        if (!u.getProtocol().equals("file")) {
-            isLocal = false;
-
-            try {
-                connection = u.openConnection();
-                is = connection.getInputStream();
-            } catch (IOException ex) {
-                System.out.println("Failed to open " + sourceUrl + " for reading.");
-                return null;
-            }
-            try {
-                os = connection.getOutputStream();
-            } catch (IOException ex) {
-                System.out.println("Failed to open " + sourceUrl + " for writing.");
-                return null;
-            }
-
-            // copy the resource to a tmp location
-            FileOutputStream fos = null;
-            try {
-                path = System.getProperty("karaf.data") + "/editor/" + UUID.randomUUID();
-                File f = new File(path);
-                if (!f.exists()) {
-                    if (!f.getParentFile().exists()) {
-                        f.getParentFile().mkdirs();
-                    }
-                }
-
-                fos = new FileOutputStream(f);
-                StreamUtils.copy(is, fos);
-            } catch (Exception ex) {
-                System.out.println("Failed to copy resource from url:" + sourceUrl + " to tmp file: " + path + "  for editing.");
-            } finally {
-                StreamUtils.close(fos);
-            }
-        } else {
-            path = u.getFile();
-        }
-
-
-        File file = new File(path);
-        if (!file.exists()) {
-            if (!file.getParentFile().exists()) {
-                file.getParentFile().mkdirs();
-            }
-        }
-
-        // call the editor
-        ConsoleEditor editor = editorFactory.create(getTerminal());
-        editor.setTitle("Karaf");
-        editor.open(file.getAbsolutePath(), url);
-        editor.setOpenEnabled(false);
-        editor.start();
-
-        // if resource is not local, copy the resource back
-        if (!isLocal) {
-            FileInputStream fis = new FileInputStream(path);
-            try {
-                StreamUtils.copy(fis, os);
-            } finally {
-                StreamUtils.close(fis);
-            }
-        }
-
-        if (is != null) {
-            StreamUtils.close(is);
-        }
-
-        if (os != null) {
-            StreamUtils.close(os);
-        }
-
+        org.jline.terminal.Terminal terminal = (org.jline.terminal.Terminal) session.get(".jline.terminal");
+        Path pwd = Paths.get(System.getProperty("karaf.home"));
+        org.jline.builtins.Commands.nano(terminal, System.out, System.err, pwd,
+                urls.toArray(new String[urls.size()]));
         return null;
     }
-
-    /**
-     * Gets the {@link jline.Terminal} from the current session.
-     *
-     * @return
-     * @throws Exception
-     */
-    private jline.Terminal getTerminal() throws Exception {
-        try {
-            return (jline.Terminal) terminal.getClass().getMethod("getTerminal").invoke(terminal);
-        } catch (Throwable t) {
-            return new TerminalSupport(true) {
-                @Override
-                public int getWidth() {
-                    return terminal.getWidth();
-                }
-
-                @Override
-                public int getHeight() {
-                    return terminal.getHeight();
-                }
-            };
-        }
-    }
-
-    public EditorFactory getEditorFactory() {
-        return editorFactory;
-    }
-
-    public void setEditorFactory(EditorFactory editorFactory) {
-        this.editorFactory = editorFactory;
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java
index 573714e..4045cf5 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java
@@ -31,7 +31,7 @@ import org.apache.karaf.shell.api.action.Argument;
 import org.apache.karaf.shell.api.action.Command;
 import org.apache.karaf.shell.api.action.Option;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.fusesource.jansi.Ansi;
+import org.apache.karaf.shell.support.ansi.SimpleAnsi;
 
 
 @Command(scope = "shell", name="grep", description="Prints lines matching the given pattern.", detailedDescription="classpath:grep.txt")
@@ -128,20 +128,15 @@ public class GrepAction implements Action {
                         if (!invertMatch && color != ColorOption.never) {
                             int index = matcher2.start(0);
                             String prefix = line.substring(0,index);
-                            matcher2.appendReplacement(sb, Ansi.ansi()
-                                .bg(Ansi.Color.YELLOW)
-                                .fg(Ansi.Color.BLACK)
-                                .a(matcher2.group())
-                                 .reset()
-                                .a(lastEscapeSequence(prefix))
-                                .toString());
+                            matcher2.appendReplacement(sb,
+                                    "\u001b[33;40m" + matcher2.group() + "\u001b[39;49m" + lastEscapeSequence(prefix));
                         } else {
                             matcher2.appendReplacement(sb, matcher2.group());
                         }
                         nb++;
                     }
                     matcher2.appendTail(sb);
-                    sb.append(Ansi.ansi().reset().toString());
+                    sb.append(SimpleAnsi.RESET);
                     if (!count && lineNumber) {
                         lines.add(String.format("%6d  ", lineno) + sb.toString());
                     } else {
@@ -199,7 +194,7 @@ public class GrepAction implements Action {
      * @return
      */
     private String lastEscapeSequence(String str) {
-        String escapeSequence=Ansi.ansi().reset().toString();
+        String escapeSequence = SimpleAnsi.RESET;
         String escapePattern = "(\\\u001B\\[[0-9;]*[0-9]+m)+";
         Pattern pattern =  Pattern.compile(escapePattern);
         Matcher matcher = pattern.matcher(str);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java
index d665a03..f4b0157 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java
@@ -19,10 +19,10 @@ package org.apache.karaf.shell.commands.impl;
 import org.apache.karaf.shell.api.action.Action;
 import org.apache.karaf.shell.api.action.Command;
 import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.api.console.History;
 import org.apache.karaf.shell.api.action.lifecycle.Reference;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.fusesource.jansi.Ansi;
+import org.apache.karaf.shell.api.console.History;
+import org.apache.karaf.shell.support.ansi.SimpleAnsi;
 
 /**
  * History command
@@ -39,19 +39,15 @@ public class HistoryAction implements Action {
 
     @Override
     public Object execute() throws Exception {
-        if (history != null && clear) {
-            history.clear();
-        }
-        
-        if (!clear) {
-            for (int index = history.first(); index <= history.last(); index++) {
-                System.out.println(
-                    Ansi.ansi()
-                        .a("  ")
-                        .a(Ansi.Attribute.INTENSITY_BOLD).render("%3d", index).a(Ansi.Attribute.INTENSITY_BOLD_OFF)
-                        .a("  ")
-                        .a(history.get(index))
-                        .toString());
+        if (history != null) {
+            if (clear) {
+                history.clear();
+            } else {
+                for (int index = history.first(); index <= history.last(); index++) {
+                    System.out.println(
+                            "  " + SimpleAnsi.INTENSITY_BOLD + String.format("%3d", index) + SimpleAnsi.INTENSITY_NORMAL
+                                    + "  " + history.get(index));
+                }
             }
         }
         return null;

http://git-wip-us.apache.org/repos/asf/karaf/blob/b4ae5245/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/InfoAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/InfoAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/InfoAction.java
index c116861..f6221e9 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/InfoAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/InfoAction.java
@@ -41,7 +41,7 @@ import org.apache.karaf.shell.commands.info.InfoProvider;
 import org.apache.karaf.shell.api.action.Action;
 import org.apache.karaf.shell.api.action.Command;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.fusesource.jansi.Ansi;
+import org.apache.karaf.shell.support.ansi.SimpleAnsi;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
@@ -214,9 +214,9 @@ public class InfoAction implements Action {
     }
 
     void printValue(String name, int pad, String value) {
-        System.out.println(Ansi.ansi().a("  ")
-                .a(Ansi.Attribute.INTENSITY_BOLD).a(name).a(spaces(pad - name.length())).a(Ansi.Attribute.RESET)
-                .a("   ").a(value).toString());
+        System.out.println(
+                "  " + SimpleAnsi.INTENSITY_BOLD + name + SimpleAnsi.INTENSITY_NORMAL
+                        + spaces(pad - name.length()) + "   ");
     }
 
     String spaces(int nb) {


Mime
View raw message