File tree Expand file tree Collapse file tree 7 files changed +40
-14
lines changed Expand file tree Collapse file tree 7 files changed +40
-14
lines changed Original file line number Diff line number Diff line change 112.9.0 (TBA)
22------------------
33
4+ Buxfixes:
5+
46* Fixed typo in `argbash-init` and updated obsolete/incaccurate hints (#97).
7+ * Fixed incorrect permission of non-script output files (#104).
58
69
7102.8.1 (2019-06-30)
Original file line number Diff line number Diff line change 3030
3131die ()
3232{
33- local _ret=$2
34- test -n " $_ret " || _ret=1
35- test " $_PRINT_HELP " = yes && print_help >&2
33+ local _ret=" ${2:- 1} "
34+ test " ${_PRINT_HELP:- no} " = yes && print_help >&2
3635 echo " $1 " >&2
37- exit ${_ret}
36+ exit " ${_ret} "
3837}
3938
4039# validators
@@ -407,6 +406,18 @@ get_parsing_code()
407406 echo " $_newerfile "
408407}
409408
409+
410+ # $1: The output file
411+ # $2: The output type string
412+ set_output_permission ()
413+ {
414+ if grep -q ' \<script\>' <<< " $2"
415+ then
416+ chmod a+x " $1 "
417+ fi
418+ }
419+
420+
410421# MS Windows compatibility fix
411422discard=/dev/null
412423test -e $discard || discard=NUL
466477if test " $outfname " ! = ' -'
467478then
468479 printf " %s\\ n" " $output " > " $outfname "
469- chmod a+x " $outfname "
480+ set_output_permission " $outfname " " $_arg_type "
470481else
471482 printf " %s\\ n" " $output "
472483fi
Original file line number Diff line number Diff line change @@ -18,11 +18,10 @@ version=2.8.1
1818
1919die ()
2020{
21- local _ret=$2
22- test -n " $_ret " || _ret=1
23- test " $_PRINT_HELP " = yes && print_help >&2
21+ local _ret=" ${2:- 1} "
22+ test " ${_PRINT_HELP:- no} " = yes && print_help >&2
2423 echo " $1 " >&2
25- exit ${_ret}
24+ exit " ${_ret} "
2625}
2726
2827
Original file line number Diff line number Diff line change @@ -26,11 +26,10 @@ version=2.8.1
2626
2727die ()
2828{
29- local _ret=$2
30- test -n " $_ret " || _ret=1
31- test " $_PRINT_HELP " = yes && print_help >&2
29+ local _ret=" ${2:- 1} "
30+ test " ${_PRINT_HELP:- no} " = yes && print_help >&2
3231 echo " $1 " >&2
33- exit ${_ret}
32+ exit " ${_ret} "
3433}
3534
3635# validators
Original file line number Diff line number Diff line change @@ -190,6 +190,18 @@ get_parsing_code()
190190 echo " $_newerfile "
191191}
192192
193+
194+ # $1: The output file
195+ # $2: The output type string
196+ set_output_permission ()
197+ {
198+ if grep -q ' \<script\>' <<< " $2"
199+ then
200+ chmod a+x " $1 "
201+ fi
202+ }
203+
204+
193205# MS Windows compatibility fix
194206discard=/dev/null
195207test -e $discard || discard=NUL
249261if test " $outfname " ! = ' -'
250262then
251263 printf " %s\\ n" " $output " > " $outfname "
252- chmod a+x " $outfname "
264+ set_output_permission " $outfname " " $_arg_type "
253265else
254266 printf " %s\\ n" " $output "
255267fi
Original file line number Diff line number Diff line change @@ -563,6 +563,7 @@ basic-docopt: $(TESTDIR)/basic.txt
563563 grep -q " \[<pos-opt>\]" $<
564564 grep -q " \[--opt_arg OPT_ARG\]" $<
565565 grep -q " \s-o OPT_ARG, --opt_arg OPT_ARG\s" $<
566+ ! test -x $<
566567
567568test-onlyopt-docopt : $(TESTDIR ) /test-onlyopt.txt
568569 grep -q " \[--opt-repeated OPT-REPEATED\]\.\.\." $<
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ ADD_DOCOPT_TEST([basic], [[
22 grep -q "\[ <pos-opt>\] " $<
33 grep -q "\[ --opt_arg OPT_ARG\] " $<
44 grep -q "\s-o OPT_ARG, --opt_arg OPT_ARG\s" $<
5+ ! test -x $<
56] ] )
67
78ADD_DOCOPT_TEST([ test-onlyopt] , [ [
You can’t perform that action at this time.
0 commit comments