You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/02/06 23:04:00 UTC

[jira] [Commented] (KARAF-6538) Add exec:groovy command

    [ https://issues.apache.org/jira/browse/KARAF-6538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17684964#comment-17684964 ] 

ASF GitHub Bot commented on KARAF-6538:
---------------------------------------

awrb opened a new pull request, #1712:
URL: https://github.com/apache/karaf/pull/1712

   Added two commands that activate when groovy feature is installed:
   ```
   karaf@root()> groovy:exec --help                                                                                                                                                      
   DESCRIPTION
           groovy:exec
   
           Executes Groovy code
   
   SYNTAX
           groovy:exec script [args] 
   
   ARGUMENTS
           script
                   Groovy code
                   (required)
           args
                   Arguments in the format of key=value
   
   karaf@root()> groovy:exec-file --help                                                                                                                          
   DESCRIPTION
           groovy:exec-file
   
           Executes Groovy file
   
   SYNTAX
           groovy:exec-file path 
   
   ARGUMENTS
           path
                   Groovy script file path
                   (required)
   
   
   karaf@root()> groovy:exec "1+1"
   2
   karaf@root()> groovy:exec "(x as int) + (y as int)" x=1 y=2
   3
   karaf@root()> cat /home/aleksy/test.groovy                                                                                                                                            
   def add(x, y) {
    return x + y
   }
   
   add(1,2)
   karaf@root()> groovy:exec-file /home/aleksy/test.groovy                                                                                                               
   3
   ```




> Add exec:groovy command
> -----------------------
>
>                 Key: KARAF-6538
>                 URL: https://issues.apache.org/jira/browse/KARAF-6538
>             Project: Karaf
>          Issue Type: Improvement
>          Components: karaf
>            Reporter: Jean-Baptiste Onofré
>            Priority: Major
>
> For testing purposes, it would be helpful to be able to execute groovy scripts directly in the shell console.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)