diff --git a/contig_info.sh b/contig_info.sh index 14a059da4889513b7da3993a717b8d8d1b62187f..c17a2ce98cdd4315c94e12b74ea9af43013661b9 100755 --- a/contig_info.sh +++ b/contig_info.sh @@ -70,12 +70,13 @@ ############################################################################################################# # # # ================ # -# = MANUAL = # +# = FUNCTIONS = # # ================ # # # +# = mandoc() ============================================================================================= # +# prints the doc # # # -if [ "$1" == "-h" ] || [ $# -lt 1 ] -then +mandoc() { echo -e "\n\033[1m contig_info v$VERSION $COPYRIGHT\033[0m"; cat <<EOF @@ -93,16 +94,7 @@ then -h prints this help and exits EOF - [ "$1" == "-h" ] && exit 0 || exit 1 ; -fi -# # -############################################################################################################# - -############################################################################################################# -# # -# ================ # -# = FUNCTIONS = # -# ================ # +} # # # = randomfile() ========================================================================================= # # creates a random file within $TEMP_DIR and returns its name # @@ -118,6 +110,8 @@ randomfile() { #### INITIALIZING PARAMETERS AND READING OPTIONS #### #### #### ############################################################################################################# +if [ $# -lt 1 ]; then mandoc ; exit 1 ; fi + export LC_ALL=C; MIN_CONTIG_LGT=1; @@ -125,15 +119,15 @@ GENOME_SIZE=0; RES_CONTENT=false; TSVOUT=false; -while getopts m:g:tr option +while getopts m:g:trh option do case $option in - m) MIN_CONTIG_LGT=$OPTARG ;; - g) GENOME_SIZE=$OPTARG ;; - r) RES_CONTENT=true ;; - t) TSVOUT=true ;; - :) echo "option $OPTARG : missing argument" ; exit 1 ;; - \?) echo "$OPTARG : option invalide" ; exit 1 ;; + m) MIN_CONTIG_LGT=$OPTARG ;; + g) GENOME_SIZE=$OPTARG ;; + r) RES_CONTENT=true ;; + t) TSVOUT=true ;; + h) mandoc ; exit 0 ;; + \?) mandoc ; exit 1 ;; esac done if ! [[ $MIN_CONTIG_LGT =~ ^[0-9]+$ ]]; then echo " incorrect value (option -m): $MIN_CONTIG_LGT" >&2 ; exit 1 ; fi