Automatically truncate suggested app name

Ref #83
This commit is contained in:
3wc 2021-03-14 03:33:33 +02:00
parent 1a649c56cb
commit 8cb6617a0f

4
abra
View File

@ -755,6 +755,10 @@ sub_app_new (){
# TYPE=custom-html, DOMAIN=foo.bar-baz.com # TYPE=custom-html, DOMAIN=foo.bar-baz.com
# -> custom_html_foo_bar_baz_com # -> custom_html_foo_bar_baz_com
DEFAULT_NAME="${TYPE/-/_}_${DOMAIN//+([.-])/_}" DEFAULT_NAME="${TYPE/-/_}_${DOMAIN//+([.-])/_}"
# truncate to 45 chars (see below)
DEFAULT_NAME="${DEFAULT_NAME:0:45}"
# and remove trailing _
DEFAULT_NAME="${DEFAULT_NAME%%_}"
read -rp "App name [$DEFAULT_NAME]: " APP_NAME read -rp "App name [$DEFAULT_NAME]: " APP_NAME
if [ -z "$APP_NAME" ]; then if [ -z "$APP_NAME" ]; then
APP_NAME="$DEFAULT_NAME" APP_NAME="$DEFAULT_NAME"