You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by matthiaw <mi...@web.de> on 2019/06/04 18:31:16 UTC
Change Prompt after executing a command
Is it possible to change the session variable "PROMPT" by a executed custom
command in a bundle?
For example:
karaf@root()> item:add Something
Created item with id 12345 and content "Hello World!"
karaf@root():item:12345>item:change content "42 rules"
Changed content of item with id 12345 to "42 rules"
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: Change Prompt after executing a command
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Matthias,
You can register whatever you want in the session and check the session
content (like PROMPT_ORIGIN if you want).
Regards
JB
On 05/06/2019 19:32, matthiaw wrote:
> Thanks. This works. Is there a possibility to add a session-listener? When i
> am in a subshell and set the command "exit", then i need to set the new
> prompt, but there is no possibility. I only can "reset" the prompt with
> dynamic values, when i am excecution my own commands, but not the "default"
> ones.
>
> Or do i have to override the default ones, like "exit".
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: Change Prompt after executing a command
Posted by matthiaw <mi...@web.de>.
Thanks. This works. Is there a possibility to add a session-listener? When i
am in a subshell and set the command "exit", then i need to set the new
prompt, but there is no possibility. I only can "reset" the prompt with
dynamic values, when i am excecution my own commands, but not the "default"
ones.
Or do i have to override the default ones, like "exit".
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: Change Prompt after executing a command
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,
you can change PROMPT property in the command Session.
The command has an access to Session, so you can do:
...
public class MyCommand implements Action {
@Reference
Session session;
public Object execute() {
session.put(Session.PROMPT, "fooo");
return null;
}
Regards
JB
On 04/06/2019 20:31, matthiaw wrote:
> Is it possible to change the session variable "PROMPT" by a executed custom
> command in a bundle?
>
> For example:
>
> karaf@root()> item:add Something
> Created item with id 12345 and content "Hello World!"
> karaf@root():item:12345>item:change content "42 rules"
> Changed content of item with id 12345 to "42 rules"
>
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com