Karaf
  1. Karaf
  2. KARAF-960

Add information about available variables in the Karaf shell

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.4, 3.0.0
    • Fix Version/s: None
    • Component/s: karaf-documentation
    • Labels:
      None

      Description

      It would be good to add information about the available variables ($.bundles, $.context, ...) and the closure syntax in the Karaf shell to the Karaf documentation. A user on the ServiceMix mailing list was asking about more information on this topic (cfr. http://servicemix.396122.n5.nabble.com/karaf-shell-each-example-td3347514.html#a4919235) and it would make a nice addition to what's already available in http://karaf.apache.org/manual/latest-2.2.x/developers-guide/shell-syntax.html

        Activity

        Hide
        Guillaume Nodet added a comment - - edited

        The list of all commands can be retrieved using:

        karaf@root> $.commands
        bundles:addcommand
        bundles:removecommand
        bundles:eval
        *:help
        shell:history
        shell:logout
        shell:echo
        ....
        
        Show
        Guillaume Nodet added a comment - - edited The list of all commands can be retrieved using: karaf@root> $.commands bundles:addcommand bundles:removecommand bundles:eval *:help shell:history shell:logout shell:echo ....
        Hide
        Guillaume Nodet added a comment -

        Note that the list of existing shell variables can be retrieved using:

        
        karaf@root> $.variables
        karaf.lastException
        a
        SCOPE
        APPLICATION
        .jline.terminal
        lde
        .jline.history
        USER
        #LINES
        .jline.reader
        #COLUMNS
        ld
        cl
        la
        
        karaf@root> 
        
        Show
        Guillaume Nodet added a comment - Note that the list of existing shell variables can be retrieved using: karaf@root> $.variables karaf.lastException a SCOPE APPLICATION .jline.terminal lde .jline.history USER #LINES .jline.reader #COLUMNS ld cl la karaf@root>
        Hide
        Guillaume Nodet added a comment -

        Yes,

        
        addcommand system (($.context bundle) loadClass java.lang.System)
        
        
        Show
        Guillaume Nodet added a comment - Yes, addcommand system (($.context bundle) loadClass java.lang. System )
        Hide
        Dr. Dietmar Wolz added a comment -

        Is there a workaround for the "Command not found: loadClass" issue - any other way to load a Java class in 2.2.4?

        Show
        Dr. Dietmar Wolz added a comment - Is there a workaround for the "Command not found: loadClass" issue - any other way to load a Java class in 2.2.4?
        Hide
        Łukasz Dywicki added a comment -

        Example form docs doesn't work any more - in Karaf 2.2.4, eg

        addcommand system (loadClass java.lang.System) 
        Command not found: loadClass
        
        Show
        Łukasz Dywicki added a comment - Example form docs doesn't work any more - in Karaf 2.2.4, eg addcommand system (loadClass java.lang. System ) Command not found: loadClass
        Hide
        Gert Vanthienen added a comment -

        Sure, that would be nice too - or perhaps implement tab-completion for this so you can just do $.<TAB> to get the options available ?

        Show
        Gert Vanthienen added a comment - Sure, that would be nice too - or perhaps implement tab-completion for this so you can just do $.<TAB> to get the options available ?
        Hide
        Jean-Baptiste Onofré added a comment -

        Agree.

        In addition of the documentation, we can add a shell:variables command to display all known variables, session variables, system variables.

        WDYT ?

        Show
        Jean-Baptiste Onofré added a comment - Agree. In addition of the documentation, we can add a shell:variables command to display all known variables, session variables, system variables. WDYT ?

          People

          • Assignee:
            Unassigned
            Reporter:
            Gert Vanthienen
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development