From d649452ff0b6277d350ff552a9a6360c375cdfe5 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Thu, 25 Feb 2016 11:40:08 +0100 Subject: [PATCH] add description in source command. Add completion for source command --- commands/source.py | 11 ++++++++++- complete_sat.sh | 32 ++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/commands/source.py b/commands/source.py index c7c1ad1..e64ea26 100644 --- a/commands/source.py +++ b/commands/source.py @@ -24,7 +24,7 @@ import src # Define all possible option for log command : sat log 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. ''' diff --git a/complete_sat.sh b/complete_sat.sh index fc03d4e..c78ce05 100755 --- a/complete_sat.sh +++ b/complete_sat.sh @@ -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 -- 2.39.2