Automatically truncate suggested app name
continuous-integration/drone/push Build is passing Details

Ref #83
This commit is contained in:
3wc 2021-03-14 03:33:33 +02:00
parent 1a649c56cb
commit 8cb6617a0f
1 changed files with 4 additions and 0 deletions

4
abra
View File

@ -755,6 +755,10 @@ sub_app_new (){
# TYPE=custom-html, DOMAIN=foo.bar-baz.com
# -> custom_html_foo_bar_baz_com
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
if [ -z "$APP_NAME" ]; then
APP_NAME="$DEFAULT_NAME"