]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
add description in source command. Add completion for source command
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Thu, 25 Feb 2016 10:40:08 +0000 (11:40 +0100)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Thu, 25 Feb 2016 10:40:08 +0000 (11:40 +0100)
commands/source.py
complete_sat.sh

index c7c1ad11183c993f22f036abeedbd1b650cddb97..e64ea267eb589f414552e1d4e54a77ee44cf38b2 100644 (file)
@@ -24,7 +24,7 @@ import src
 # Define all possible option for log command :  sat log <options>
 parser = src.options.Options()
 parser.add_option('m', 'module', 'list2', 'modules',
-    _('modules to get the sources. This option can be'
+    _('modules from which to get the sources. This option can be'
     ' passed several time to get the sources of several modules.'))
 parser.add_option('', 'no_sample', 'boolean', 'no_sample', 
     _("do not get sources from sample modules."))
@@ -418,6 +418,15 @@ def get_all_module_sources(config, modules, force, logger):
 
     return good_result, results
 
+def description():
+    '''method that is called when salomeTools is called with --help option.
+    
+    :return: The text to display for the source command description.
+    :rtype: str
+    '''
+    return _("The source command gets the sources of the application modules "
+             "from cvs, git, an archive or a directory..")
+  
 def run(args, runner, logger):
     '''method that is called when salomeTools is called with source parameter.
     '''
index fc03d4ef1e9ed423176c7752e3483c9d622230cb..c78ce059fd8332d859ae3874b8109a1b3eaa1a2e 100755 (executable)
@@ -26,7 +26,7 @@ _show_applications()
             echo ${x}
         done)
 
-    # additional options for command working without products
+    # additional options for command working without applications
     case "${command}" in
         config)
             opts2=$(echo --list --value --edit --info $opts2)
@@ -39,6 +39,17 @@ _show_applications()
     COMPREPLY=( $(compgen -W "${opts2}" -- ${cur}) )
 }
 
+_show_modules()
+{
+    if [[ $appli != $prev ]]
+    then
+        opts=$(for x in `$SAT_PATH/sat -s config $appli -nv APPLICATION.modules`
+            do echo ${x}; done)
+
+        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+   fi
+}
+
 _salomeTools_complete()
 {
     if [[ "${SAT_PATH}x" == "x" ]]
@@ -69,7 +80,7 @@ _salomeTools_complete()
     # first argument => show available commands
     if [[ ${argc} == 1 ]]
     then
-        opts="config log testcommand --help"
+        opts="config log testcommand source patch --help"
         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
         return 0
     fi
@@ -101,19 +112,19 @@ _salomeTools_complete()
         
         return 0
     fi
-
-    # show list of softwares
+      
+    # show list of modules
     if [[ ${prev} == "--module" || ${prev} == "-m" ]]
     then
-        prod="${COMP_WORDS[2]}"
-        if [[ ${command} != "test" ]]
+        appli="${COMP_WORDS[2]}"
+        if [[ ${command} != "source" ]]
         then
-            opts=$(for x in `$SAT_PATH/sat config $prod -nv PRODUCT.softwares`
+            opts=$(for x in `$SAT_PATH/sat config $appli -nv APPLICATION.modules`
                 do echo ${x}; done)
 
                COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
             return 0
-           fi
+        fi
     fi
 
     # show argument for each command
@@ -128,6 +139,11 @@ _salomeTools_complete()
             COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
             return 0
             ;;
+        source)
+            opts="--modules --no_sample --force"
+            COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+            return 0
+            ;;
         *) return 0 ;;
     esac