Commit 3f6940ce authored by PENGUEN Julien's avatar PENGUEN Julien
Browse files

ajout fonction check_and_replace version linux

parent 9f12d139
......@@ -400,6 +400,38 @@ function_return_indice_arg()
}
function_check_and_replace()
{
# function_check_and_replace: check if input args is in tab and replace val
#
# inputs:
# -tab_keys: keys array of options present on $@
# -tab_keys: values array of options present on $@
# -find_arg: option we want find
# -val_arg: option value by default
tab_keys=$1
tab_values=$2
find_arg=$3
val_arg=$4
tempo_tab_keys=( ${tab_keys// / } )
tempo_tab_values=( ${tab_values// / } )
if [[ "${tempo_tab_keys[@]}" =~ $find_arg ]]; then
indice=`function_return_indice_arg "${tempo_tab_keys[*]}" $find_arg`
echo "${sort_arg_values[$indice]}"
else
echo ${val_arg}
fi
}
function_jar_updated_search()
{
# function_jar_updated_search: get the last jar version
......@@ -750,65 +782,39 @@ sort_arg_values=( ${tab_sort_arg_values// / } )
sort_arg_weight=( ${tab_sort_arg_weight// / } )
#------------------------------#
#check survey or area input args
#check survey input args
if [[ "${sort_arg_keys[@]}" =~ "--survey" ]]; then
RESULT_INDICE_SURVEY=`function_return_indice_arg "${sort_arg_keys[*]}" "--survey"`
INPUT_FILE_SURVEYS=${sort_arg_values[$RESULT_INDICE_SURVEY]}
fi
INPUT_FILE_SURVEYS=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--survey" $INPUT_FILE_SURVEYS`
if [[ "${sort_arg_keys[@]}" =~ "--area" ]]; then
RESULT_INDICE_AREA=`function_return_indice_arg "${sort_arg_keys[*]}" "--area"`
INPUT_FILE_AREAS=${sort_arg_values[$RESULT_INDICE_AREA]}
fi
#------------------------------#
#check area input args
INPUT_FILE_AREAS=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--area" $INPUT_FILE_AREAS`
#-------------------------------------#
#check angular input arg
if [[ "${sort_arg_keys[@]}" =~ "--angular" ]]; then
RESULT_INDICE_ANGULAR=`function_return_indice_arg "${sort_arg_keys[*]}" "--angular"`
ANGULAR=${sort_arg_values[$RESULT_INDICE_ANGULAR]}
fi
ANGULAR=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--angular" $ANGULAR`
#-------------------------------------#
#check resolution line input args
if [[ "${sort_arg_keys[@]}" =~ "--resolution_line" ]]; then
RESULT_INDICE_RESOLUTION_LINE=`function_return_indice_arg "${sort_arg_keys[*]}" "--resolution_line"`
RESOLUTION_BY_LINE=${sort_arg_values[$RESULT_INDICE_RESOLUTION_LINE]}
fi
RESOLUTION_BY_LINE=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--resolution_line" $RESOLUTION_BY_LINE`
#-------------------------------------#
#check resolution col input args
if [[ "${sort_arg_keys[@]}" =~ "--resolution_col" ]]; then
RESULT_INDICE_RESOLUTION_COL=`function_return_indice_arg "${sort_arg_keys[*]}" "--resolution_col"`
RESOLUTION_BY_COL=${sort_arg_values[$RESULT_INDICE_RESOLUTION_COL]}
fi
RESOLUTION_BY_COL=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--resolution_col" $RESOLUTION_BY_COL`
#-------------------------------------#
#check number of tile by line input args
if [[ "${sort_arg_keys[@]}" =~ "--nb_tile_line" ]]; then
RESULT_INDICE_TILE_LINE=`function_return_indice_arg "${sort_arg_keys[*]}" "--nb_tile_line"`
NB_TILE_BY_LINE=${sort_arg_values[$RESULT_INDICE_TILE_LINE]}
fi
NB_TILE_BY_LINE=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--nb_tile_line" $NB_TILE_BY_LINE`
#-------------------------------------#
#check number of tile by col input args
if [[ "${sort_arg_keys[@]}" =~ "--nb_tile_col" ]]; then
RESULT_INDICE_TILE_COL=`function_return_indice_arg "${sort_arg_keys[*]}" "--nb_tile_col"`
NB_TILE_BY_COL=${sort_arg_values[$RESULT_INDICE_TILE_COL]}
fi
NB_TILE_BY_COL=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--nb_tile_col" $NB_TILE_BY_COL`
#---------------------#
# --no_select management
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment