@@ -105,6 +105,7 @@ gh_toc(){
105105 local gh_ttl_docs=$2
106106 local need_replace=$3
107107 local no_backup=$4
108+ local no_footer=$5
108109
109110 if [ " $gh_src " = " " ]; then
110111 echo " Please, enter URL or local path for a README.md"
@@ -169,7 +170,10 @@ gh_toc(){
169170 sed -i${ext} " /${ts} /,/${te} /{//!d;}" " $gh_src "
170171 # create toc file
171172 echo " ${toc} " > " ${toc_path} "
172- echo -e " \n${toc_footer} \n" >> " $toc_path "
173+ if [ " ${no_footer} " != " yes" ]; then
174+ echo -e " \n${toc_footer} \n" >> " $toc_path "
175+ fi
176+
173177 # insert toc file
174178 if [[ " ` uname` " == " Darwin" ]]; then
175179 sed -i " " " /${ts} /r ${toc_path} " " $gh_src "
@@ -281,8 +285,8 @@ gh_toc_app() {
281285 echo " GitHub TOC generator ($app_name ): $gh_toc_version "
282286 echo " "
283287 echo " Usage:"
284- echo " $app_name [--insert] src [src] Create TOC for a README file (url or local path)"
285- echo " $app_name [--no-backup] src [src] Create TOC without backup, requires <!--ts--> / <!--te--> placeholders"
288+ echo " $app_name [--insert] [--hide-footer] src [src] Create TOC for a README file (url or local path)"
289+ echo " $app_name [--no-backup] [--hide-footer] src [src] Create TOC without backup, requires <!--ts--> / <!--te--> placeholders"
286290 echo " $app_name - Create TOC for markdown from STDIN"
287291 echo " $app_name --help Show help"
288292 echo " $app_name --version Show version"
@@ -333,10 +337,17 @@ gh_toc_app() {
333337 no_backup=" yes"
334338 shift
335339 fi
340+
341+ if [ " $1 " = ' --hide-footer' ]; then
342+ need_replace=" yes"
343+ no_footer=" yes"
344+ shift
345+ fi
346+
336347 for md in " $@ "
337348 do
338349 echo " "
339- gh_toc " $md " " $# " " $need_replace " " $no_backup "
350+ gh_toc " $md " " $# " " $need_replace " " $no_backup " " $no_footer "
340351 done
341352
342353 echo " "
0 commit comments