Salome HOME
products completion after --products or -p
authorSRE <support-salome@cea.fr>
Thu, 6 Apr 2017 08:07:54 +0000 (10:07 +0200)
committerSRE <support-salome@cea.fr>
Thu, 6 Apr 2017 08:07:54 +0000 (10:07 +0200)
commands/config.py
complete_sat.sh

index 3246548027688e2420455a982ebfde4ed811b6c4..d315df55679a5dcef259117f8b39b63672759645 100644 (file)
@@ -47,6 +47,8 @@ parser.add_option('c', 'copy', 'boolean', 'copy',
 \tIf a name is given the new config file takes the given name."""))
 parser.add_option('n', 'no_label', 'boolean', 'no_label',
     _("Internal use: do not print labels, Works only with --value and --list."))
+parser.add_option('', 'completion', 'boolean', 'completion',
+    _("Internal use: print only keys, works only with --value."))
 parser.add_option('s', 'schema', 'boolean', 'schema',
     _("Internal use."))
 
@@ -949,5 +951,10 @@ def run(args, runner, logger):
                     src.printcolors.printcLabel(runner.cfg.VARS.application), 3)
         logger.write("\n", 2, False)
         show_patchs(runner.cfg, logger)
+    
+    # case: print all the products name of the application (internal use for completion)
+    elif options.completion:
+        for product_name in runner.cfg.APPLICATION.products.keys():
+            logger.write("%s\n" % product_name)
         
     
index 29ae207c7a1cc235e8faf52eb58c94c0f57634e1..02d54c4a3d4f7f0fb6ac28cee9dc5589877043f0 100755 (executable)
@@ -67,7 +67,7 @@ _show_products()
 {
     if [[ $appli != $prev ]]
     then
-        opts=$(for x in `$SAT_PATH/sat -s config $appli -nv APPLICATION.products`
+        opts=$(for x in `$SAT_PATH/sat config $appli --completion`
             do echo ${x}; done)
 
         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
@@ -138,12 +138,12 @@ _salomeTools_complete()
     fi
       
     # show list of products
-    if [[ ${prev} == "--product" || ${prev} == "-p" ]]
+    if [[ ${prev} == "--product" || ${prev} == "-p" || ${prev} == "--info" || ${prev} == "-i" ]]
     then
         appli="${COMP_WORDS[2]}"
         if [[ ${command} != "source" ]]
         then
-            opts=$(for x in `$SAT_PATH/sat config $appli -nv APPLICATION.products`
+            opts=$(for x in `$SAT_PATH/sat config $appli --completion`
                 do echo ${x}; done)
 
                COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )