From 64e72c266e6745bc2b5756f670b46ff30fe04772 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 28 Feb 2022 23:07:06 -0600 Subject: [PATCH] Cleanup: Make scripts more consistent with their arguments. --- build/scripts/bootstrap.sh | 34 +++++++++++++++++++++------ build/scripts/install.sh | 57 ++++++++++++++++++++++++++++++---------------- build/scripts/package.sh | 34 +++++++++++++++++++++------ 3 files changed, 92 insertions(+), 33 deletions(-) diff --git a/build/scripts/bootstrap.sh b/build/scripts/bootstrap.sh index cd8d32f..689db5c 100644 --- a/build/scripts/bootstrap.sh +++ b/build/scripts/bootstrap.sh @@ -15,7 +15,7 @@ bootstrap_main() { local version=0.5.9 local grab_next= - local do_color=normal + local do_color=dark local do_help= local i=0 local m= @@ -59,6 +59,8 @@ bootstrap_main() { local defines_override= local process= local verbosity=normal + local verbose= + local verbose_common= local enable_shared= local enable_static= @@ -73,19 +75,34 @@ bootstrap_main() { if [[ $grab_next == "" ]] ; then if [[ $p == "-h" || $p == "--help" ]] ; then do_help=yes - elif [[ $p == "+n" || $p == "++no_color" ]] ; then - do_color=none + elif [[ $p == "+d" || $p == "++dark" ]] ; then + do_color=dark + context="+d" elif [[ $p == "+l" || $p == "++light" ]] ; then do_color=light + context="+l" + elif [[ $p == "+n" || $p == "++no_color" ]] ; then + do_color=none + context="+n" elif [[ $p == "+q" || $p == "++quiet" ]] ; then verbosity="quiet" verbose= + verbose_common= + elif [[ $p == "+N" || $p == "++normal" ]] ; then + verbosity= + verbose= + verbose_common= + elif [[ $p == "+V" || $p == "++verbose" ]] ; then + verbosity="verbose" + verbose="+V" + verbose_common="-v" + elif [[ $p == "+D" || $p == "++debug" ]] ; then + verbosity="debug" + verbose="+D" + verbose_common="-v" elif [[ $p == "+v" || $p == "++version" ]] ; then echo $version return - elif [[ $p == "+V" || $p == "++verbose" ]] ; then - verbosity="verbose" - verbose="-v" elif [[ $p == "-d" || $p == "--defines" ]] ; then grab_next=defines_override elif [[ $p == "-m" || $p == "--mode" ]] ; then @@ -432,10 +449,13 @@ bootstrap_help() { echo echo -e "${c_highlight}Options:$c_reset" echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." + echo -e " +${c_important}d$c_reset, ++${c_important}dark$c_reset Use color modes that show up better on dark backgrounds." echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." - echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity beyond normal output." + echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity, silencing most output." + echo -e " +${c_important}N$c_reset, ++${c_important}normal$c_reset Set verbosity to normal." echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." + echo -e " +${c_important}D$c_reset, ++${c_important}debug$c_reset Enable debugging, significantly increasing verbosity beyond normal output." echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." echo echo -e "${c_highlight}Bootstrap Options:$c_reset" diff --git a/build/scripts/install.sh b/build/scripts/install.sh index f64033f..0f56564 100644 --- a/build/scripts/install.sh +++ b/build/scripts/install.sh @@ -15,7 +15,7 @@ install_main() { local version=0.5.9 local grab_next= - local do_color=normal + local do_color=dark local do_help= local i=0 local p= @@ -37,6 +37,7 @@ install_main() { local operation_failure= local verbosity=normal local verbose= + local verbose_common= local path_build=build/ local path_programs=programs/ @@ -75,19 +76,34 @@ install_main() { if [[ $grab_next == "" ]] ; then if [[ $p == "-h" || $p == "--help" ]] ; then do_help=yes - elif [[ $p == "+n" || $p == "++no_color" ]] ; then - do_color=none + elif [[ $p == "+d" || $p == "++dark" ]] ; then + do_color=dark + context="+d" elif [[ $p == "+l" || $p == "++light" ]] ; then do_color=light + context="+l" + elif [[ $p == "+n" || $p == "++no_color" ]] ; then + do_color=none + context="+n" elif [[ $p == "+q" || $p == "++quiet" ]] ; then verbosity="quiet" verbose= + verbose_common= + elif [[ $p == "+N" || $p == "++normal" ]] ; then + verbosity= + verbose= + verbose_common= + elif [[ $p == "+V" || $p == "++verbose" ]] ; then + verbosity="verbose" + verbose="+V" + verbose_common="-v" + elif [[ $p == "+D" || $p == "++debug" ]] ; then + verbosity="debug" + verbose="+D" + verbose_common="-v" elif [[ $p == "+v" || $p == "++version" ]] ; then echo $version return - elif [[ $p == "+V" || $p == "++verbose" ]] ; then - verbosity="verbose" - verbose="-v" elif [[ $p == "-b" || $p == "--build" ]] ; then grab_next=path_build elif [[ $p == "-s" || $p == "--settings" ]] ; then @@ -360,10 +376,13 @@ install_help() { echo echo -e "${c_highlight}Options:$c_reset" echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." + echo -e " +${c_important}d$c_reset, ++${c_important}dark$c_reset Use color modes that show up better on dark backgrounds." echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." - echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity beyond normal output." + echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity, silencing most output." + echo -e " +${c_important}N$c_reset, ++${c_important}normal$c_reset Set verbosity to normal." echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." + echo -e " +${c_important}D$c_reset, ++${c_important}debug$c_reset Enable debugging, significantly increasing verbosity beyond normal output." echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." echo echo -e "${c_highlight}Install Options:$c_reset" @@ -542,7 +561,7 @@ install_perform_install() { if [[ $work != "" ]] ; then if [[ $build_sources_program != "" && ( $enable_shared_programs == "yes" || $enable_static_programs == "yes" ) ]] ; then if [[ ! -d ${work}programs ]] ; then - mkdir $verbose ${work}programs + mkdir $verbose_common ${work}programs if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -554,7 +573,7 @@ install_perform_install() { fi if [[ $enable_shared_programs == "yes" && ! -d ${work}programs/shared ]] ; then - mkdir $verbose ${work}programs/shared + mkdir $verbose_common ${work}programs/shared if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -566,7 +585,7 @@ install_perform_install() { fi if [[ $build_sources_program != "" && $enable_static_programs == "yes" && ! -d ${work}programs/static ]] ; then - mkdir $verbose ${work}programs/static + mkdir $verbose_common ${work}programs/static if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -580,7 +599,7 @@ install_perform_install() { if [[ $build_sources_library != "" && ( $enable_shared_libraries == "yes" || $enable_static_libraries == "yes" ) ]] ; then if [[ ! -d ${work}libraries ]] ; then - mkdir $verbose ${work}libraries + mkdir $verbose_common ${work}libraries if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -592,7 +611,7 @@ install_perform_install() { fi if [[ $build_sources_library != "" && $enable_shared_libraries == "yes" && ! -d ${work}libraries/shared ]] ; then - mkdir $verbose ${work}libraries/shared + mkdir $verbose_common ${work}libraries/shared if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -604,7 +623,7 @@ install_perform_install() { fi if [[ $build_sources_library != "" && $enable_static_libraries == "yes" && ! -d ${work}libraries/static ]] ; then - mkdir $verbose ${work}libraries/static + mkdir $verbose_common ${work}libraries/static if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -618,7 +637,7 @@ install_perform_install() { if [[ $build_sources_headers != "" && $enable_includes == "yes" ]] ; then if [[ ! -d ${work}includes ]] ; then - mkdir $verbose ${work}includes + mkdir $verbose_common ${work}includes if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -648,7 +667,7 @@ install_perform_install() { echo -e "${c_highlight}Installing Includes to: $c_reset$c_notice$destination_includes$c_reset${c_highlight}.$c_reset" fi - cp $verbose -R $path_build${path_includes}* $destination_includes + cp $verbose_common -R $path_build${path_includes}* $destination_includes if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -666,7 +685,7 @@ install_perform_install() { echo -e "${c_highlight}Installing (static) Libraries to: $c_reset$c_notice$destination_libraries_static$c_reset${c_highlight}.$c_reset" fi - cp $verbose -R $path_build$path_libraries${path_static}* $destination_libraries_static + cp $verbose_common -R $path_build$path_libraries${path_static}* $destination_libraries_static if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -683,7 +702,7 @@ install_perform_install() { echo -e "${c_highlight}Installing (shared) Libraries to: $c_reset$c_notice$destination_libraries_shared$c_reset${c_highlight}.$c_reset" fi - cp $verbose -R $path_build$path_libraries${path_shared}* $destination_libraries_shared + cp $verbose_common -R $path_build$path_libraries${path_shared}* $destination_libraries_shared if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -702,7 +721,7 @@ install_perform_install() { echo -e "${c_highlight}Installing (static) Programs to: $c_reset$c_notice$destination_programs_static$c_reset${c_highlight}.$c_reset" fi - cp $verbose -R $path_build$path_programs${path_static}* $destination_programs_static + cp $verbose_common -R $path_build$path_programs${path_static}* $destination_programs_static if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then @@ -719,7 +738,7 @@ install_perform_install() { echo -e "${c_highlight}Installing (shared) Programs to: $c_reset$c_notice$destination_programs_shared$c_reset${c_highlight}.$c_reset" fi - cp $verbose -R $path_build$path_programs${path_shared}* $destination_programs_shared + cp $verbose_common -R $path_build$path_programs${path_shared}* $destination_programs_shared if [[ $? -ne 0 ]] ; then if [[ $verbosity != "quiet" ]] ; then diff --git a/build/scripts/package.sh b/build/scripts/package.sh index 085cfd9..44355ee 100644 --- a/build/scripts/package.sh +++ b/build/scripts/package.sh @@ -13,7 +13,7 @@ package_main() { local version=0.5.9 local grab_next= - local do_color=normal + local do_color=dark local do_help= local i=0 local p= @@ -40,6 +40,8 @@ package_main() { local path_destination=package/ local path_sources=./ local verbosity=normal + local verbose= + local verbose_common= if [[ $# -gt 0 ]] ; then t=$# @@ -51,19 +53,34 @@ package_main() { if [[ $grab_next == "" ]] ; then if [[ $p == "-h" || $p == "--help" ]] ; then do_help=yes - elif [[ $p == "+n" || $p == "++no_color" ]] ; then - do_color=none + elif [[ $p == "+d" || $p == "++dark" ]] ; then + do_color=dark + context="+d" elif [[ $p == "+l" || $p == "++light" ]] ; then do_color=light + context="+l" + elif [[ $p == "+n" || $p == "++no_color" ]] ; then + do_color=none + context="+n" elif [[ $p == "+q" || $p == "++quiet" ]] ; then verbosity="quiet" verbose= + verbose_common= + elif [[ $p == "+N" || $p == "++normal" ]] ; then + verbosity= + verbose= + verbose_common= + elif [[ $p == "+V" || $p == "++verbose" ]] ; then + verbosity="verbose" + verbose="+V" + verbose_common="-v" + elif [[ $p == "+D" || $p == "++debug" ]] ; then + verbosity="debug" + verbose="+D" + verbose_common="-v" elif [[ $p == "+v" || $p == "++version" ]] ; then echo $version return - elif [[ $p == "+V" || $p == "++verbose" ]] ; then - verbosity="verbose" - verbose="-v" elif [[ $p == "-b" || $p == "--build" ]] ; then grab_next=path_build elif [[ $p == "-d" || $p == "--destination" ]] ; then @@ -289,10 +306,13 @@ package_help() { echo echo -e "${c_highlight}Options:$c_reset" echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." + echo -e " +${c_important}d$c_reset, ++${c_important}dark$c_reset Use color modes that show up better on dark backgrounds." echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." - echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity beyond normal output." + echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity, silencing most output." + echo -e " +${c_important}N$c_reset, ++${c_important}normal$c_reset Set verbosity to normal." echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." + echo -e " +${c_important}D$c_reset, ++${c_important}debug$c_reset Enable debugging, significantly increasing verbosity beyond normal output." echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." echo echo -e "${c_highlight}Package Options:$c_reset" -- 1.8.3.1