As an alternative (if you need), you can also use the session.execute() method.
Look at the admin:connect commands if you want: https://github.com/apache/karaf/blob/karaf-2.x/admin/command/src/main/java/= org/apache/karaf/admin/command/ConnectCommand.java#L42<https://github.com/apache/karaf/blob/karaf-2.x/admin/command/src/main/java/=org/apache/karaf/admin/command/ConnectCommand.java#L42> 2013/12/3 Patryk Kucharz <[email protected]> > Thank you for your help. > > Regards, > PK > > > 2013/12/2 Jean-Baptiste Onofré <[email protected]> > >> Hi Patryk, >> >> You don't have to create command, just create an alias that execute what >> you want. >> >> For condition check, looping, etc, you can use shell:if, shell:while, etc. >> >> You can find some details here: >> >> http://karaf.apache.org/manual/latest/developers-guide/shell-syntax.html >> >> Regards >> JB >> >> >> On 12/02/2013 02:20 PM, Patryk Kucharz wrote: >> >>> Hi Jean, >>> >>> Thank you for your answer. I think your solution will be very useful. >>> >>> But is it possible to call from my command already implemented functions >>> or scripts? >>> Maybe I can use my command to call shell:source. Generally, my intention >>> is to try do some things automatically. For instance, when bundle won't >>> install successfully I would like Karaf to try repeat whole procedure >>> again automatically or react in some other way. >>> >>> Regards, >>> PK >>> >>> >>> 2013/12/2 Jean-Baptiste Onofré <[email protected] <mailto:[email protected] >>> >> >>> >>> >>> Hi Patryk, >>> >>> Why not directly creating an alias in etc/shell.init.script that >>> perform these actions ? >>> >>> You script can be called with shell:source command too. >>> >>> Regards >>> JB >>> >>> >>> On 12/02/2013 12:50 PM, Patryk Kucharz wrote: >>> >>> Hello, >>> >>> I am trying to add some new commands to karaf console. I have >>> read that >>> tutorial: >>> http://karaf.apache.org/__manual/latest-2.2.x/__ >>> developers-guide/extending-__console.html >>> >>> <http://karaf.apache.org/manual/latest-2.2.x/ >>> developers-guide/extending-console.html> >>> >>> I am wondering if there is any possibility to call from my new >>> command >>> the one of those already implemented commands? >>> >>> For instance, I would like to implement command which will add >>> feature, >>> install it and then show the list of already installed features. >>> That is >>> why I need to call features:addurl, features:install, >>> features:list etc. >>> >>> I appreciate any help from your side. >>> >>> Regards, >>> PK >>> >>> >>> -- >>> Jean-Baptiste Onofré >>> [email protected] <mailto:[email protected]> >>> >>> http://blog.nanthrax.net >>> Talend - http://www.talend.com >>> >>> >>> >> -- >> Jean-Baptiste Onofré >> [email protected] >> http://blog.nanthrax.net >> Talend - http://www.talend.com >> > >
