I have an OSGi environment which runs on equinox. For the execution of custom comands I use the gogo shell (org.apache.felix.gogo.command, org.apache.felix.gogo.shell).
By default the command scope is set to equinox so the help
command does not print anything. If I use felix:help
it does print all of the available commands.
How do I switch the default command scope to felix
? Is there a way to give the system a startup script which sets that up?
Additionally, how can I force the user to use the scope I introduce in the component property like shown here:
property = {
"osgi.command.scope=myScope",
"osgi.command.function=myFunc"
}
=> I want that the user has to write myScope:myFunc
into the shell. Is that possible anyhow?
Thanks for your help :-)
You can make your own commands since Gogo has closures.
Welcome to Apache Felix Gogo
g!
g! h = { felix:help }
felix:help
g! h
felix:bundlelevel
felix:cd
felix:frameworklevel
...
g! $h
felix:help
You can put a startup script in ./etc/gosh_profile
, where .
is the current working directory.
The SCOPE
variable sets up a colon separated path for searching the scopes.
g! SCOPE='felix:*'
Gogo is way more powerful that almost everybody I know thinks. Gogo can basically call any Java function with shell like syntax. You can see some examples here: https://v2archive.enroute.osgi.org/appnotes/gogo.html