mirror of
https://github.com/scopatz/nanorc
synced 2025-06-20 13:40:07 +02:00
Better IFS and parameters
This commit is contained in:
parent
e1bba94e7b
commit
5125a77303
54
install.sh
54
install.sh
@ -19,12 +19,13 @@
|
|||||||
# Ativate or not the erros (1=activated)
|
# Ativate or not the erros (1=activated)
|
||||||
OPTERR=1
|
OPTERR=1
|
||||||
# Separator (useful for simulate arrays)
|
# Separator (useful for simulate arrays)
|
||||||
IFS=" "
|
G_IFS=" "
|
||||||
|
|
||||||
# Global Variables
|
# Global Variables
|
||||||
G_VERSION="1.0.0"
|
G_VERSION="1.0.0"
|
||||||
G_NANORC_FILE="~/.nanorc"
|
|
||||||
G_DEPS="unzip sed wget"
|
G_DEPS="unzip sed wget"
|
||||||
|
G_LITE=false
|
||||||
|
G_FILE="~/.nanorc"
|
||||||
|
|
||||||
# Exit Values Help
|
# Exit Values Help
|
||||||
# 0 - OK
|
# 0 - OK
|
||||||
@ -40,9 +41,11 @@ f_menu_usage(){
|
|||||||
echo "Get nano editor better to use and see."
|
echo "Get nano editor better to use and see."
|
||||||
echo
|
echo
|
||||||
echo "-l Activate lite installation."
|
echo "-l Activate lite installation."
|
||||||
|
echo " We will take account your existing .nanorc files."
|
||||||
echo "-v Show version, license and other info."
|
echo "-v Show version, license and other info."
|
||||||
echo "-h Show help or usage."
|
echo "-h Show help or usage."
|
||||||
echo "-f FILE Other file instead of the default .nanorc file."
|
echo "-f FILE"
|
||||||
|
echo " Other file instead of the default .nanorc file."
|
||||||
|
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
@ -58,6 +61,8 @@ f_menu_version(){
|
|||||||
echo "There is NO WARRANTY, to the extent permitted by law."
|
echo "There is NO WARRANTY, to the extent permitted by law."
|
||||||
echo
|
echo
|
||||||
echo "Written by Anthony Scopatz and others."
|
echo "Written by Anthony Scopatz and others."
|
||||||
|
echo
|
||||||
|
echo "For bugs report, please fill an issue at https://github.com/scopatz/nanorc"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
@ -84,6 +89,13 @@ f_check_deps(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Set IFS
|
||||||
|
f_set_ifs(){
|
||||||
|
temp=$IFS
|
||||||
|
IFS=$G_IFS
|
||||||
|
G_IFS=temp
|
||||||
|
}
|
||||||
|
|
||||||
_fetch_sources(){
|
_fetch_sources(){
|
||||||
wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip
|
wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip
|
||||||
mkdir -p ~/.nano/
|
mkdir -p ~/.nano/
|
||||||
@ -111,32 +123,38 @@ _update_nanorc_lite(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# corewct the get ifs
|
# check parameters with set variable
|
||||||
# check parameters with getopts
|
# made the script more or less verbose
|
||||||
# help version license+info output bugs report
|
|
||||||
|
|
||||||
# init main
|
# init main
|
||||||
# get the git
|
# get the git
|
||||||
# updat/create the nanorc
|
# updat/create the nanorc
|
||||||
|
|
||||||
|
# ============================
|
||||||
|
#
|
||||||
|
# MAIN / Init of script
|
||||||
|
#
|
||||||
|
# =============================
|
||||||
|
|
||||||
# Main / Init of script
|
f_set_ifs
|
||||||
|
f_check_deps && exit 2
|
||||||
|
|
||||||
f_check_deps
|
while getopts "lf:vh?" c
|
||||||
|
case $c in
|
||||||
|
l) G_LITE=true;;
|
||||||
|
f) G_FILE=$OPTARG;;
|
||||||
|
v) f_menu_version ;;
|
||||||
|
h|?|*) f_menu_usage ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
case "$1" in
|
_fetch_sources
|
||||||
-l|--lite)
|
|
||||||
UPDATE_LITE=1;;
|
|
||||||
-h|--help)
|
|
||||||
echo "Install script for nanorc syntax highlights"
|
|
||||||
echo "Call with -l or --lite to update .nanorc with secondary precedence to existing .nanorc includes"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
_fetch_sources;
|
if [ $G_LITE ];
|
||||||
if [ $UPDATE_LITE ];
|
|
||||||
then
|
then
|
||||||
_update_nanorc_lite
|
_update_nanorc_lite
|
||||||
else
|
else
|
||||||
_update_nanorc
|
_update_nanorc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
f_set_ifs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user