I think you should change the SCOPE session variable instead of
prefixing the commands.
It will allow using prefixed commands, else I fear your change will
forbid using grep inside a subshell for example.

On Mon, Jun 11, 2012 at 3:02 PM,  <[email protected]> wrote:
> Author: jbonofre
> Date: Mon Jun 11 13:02:04 2012
> New Revision: 1348828
>
> URL: http://svn.apache.org/viewvc?rev=1348828&view=rev
> Log:
> [KARAF-647] Prefix commands with the corresponding scope
>
> Modified:
>    
> karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/impl/jline/ConsoleImpl.java
>
> Modified: 
> karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/impl/jline/ConsoleImpl.java
> URL: 
> http://svn.apache.org/viewvc/karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/impl/jline/ConsoleImpl.java?rev=1348828&r1=1348827&r2=1348828&view=diff
> ==============================================================================
> --- 
> karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/impl/jline/ConsoleImpl.java
>  (original)
> +++ 
> karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/impl/jline/ConsoleImpl.java
>  Mon Jun 11 13:02:04 2012
> @@ -246,11 +246,15 @@ public class ConsoleImpl implements Cons
>                    } else {
>                        command += " " + line;
>                    }
> -                    if (reader.getHistory().size()==0) {
> -                        reader.getHistory().add(command);
> -                    } else {
> -                        reader.getHistory().replace(command);
> -                    }
> +            if (reader.getHistory().size()==0) {
> +                reader.getHistory().add(command);
> +            } else {
> +                reader.getHistory().replace(command);
> +            }
> +            // append the subshell if present
> +            if (session.get("SUBSHELL") != null && ((String) 
> session.get("SUBSHELL")).trim().length() > 0 && !command.equals("exit")) {
> +                command = session.get("SUBSHELL") + ":" + command;
> +            }
>                    try {
>                        new Parser(command).program();
>                        loop = false;
>
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Reply via email to