Provide completion for SCR commands
@@ -278,6 +278,48 @@ try {
complete -c gogo:wc -s w -l words --description "Print word count"
complete -c gogo:wc -a '__files'
+ __get_scr_components = {
+ list = [ ]
+ scrref = ($.context getServiceReference org.osgi.service.component.runtime.ServiceComponentRuntime)
+ scr = ($.context getService $scrref)
+ each ($scr getComponentDescriptionDTOs ($.context bundles)) {
+ $list add ((($it getClass) getField "name") get $it)
+ }
+ $.context ungetService $scrref
+ $list
+ }
+ __get_bundles_with_scr_components = {
+ list = [ ]
+ scrref = ($.context getServiceReference org.osgi.service.component.runtime.ServiceComponentRuntime)
+ scr = ($.context getService $scrref)
+ each ($.context bundles) {
+ if { ($scr getComponentDescriptionDTOs $it) isEmpty } { } {
+ $list add ($it symbolicName)
+ }
+ }
+ $.context ungetService $scrref
+ $list
+ }
+
+ complete -c scr:config -e
+ complete -c scr:config -d "Show the current SCR configuration"
+
+ complete -c scr:disable -e
+ complete -c scr:disable -d "Disable an enabled component"
+ complete -c scr:disable -a '__get_scr_components'
+
+ complete -c scr:enable -e
+ complete -c scr:enable -d "Enable an disabled component"
+ complete -c scr:enable -a '__get_scr_components'
+
+ complete -c scr:info -e
+ complete -c scr:info -d "Dump information of a component or component configuration"
+ complete -c scr:info -a '__get_scr_components'
+
+ complete -c scr:list -e
+ complete -c scr:list -d "List component configurations of a specific bundle"
+ complete -c scr:list -a '__get_bundles_with_scr_components'
+
# print welcome message
__resolve_uri = {
uri = $1
