capacitorjs.install(){
    console.header "Questionnaire"

    local ARGS=("$@")
    local _BASE_REPO_URL="$__capacitorjs_DEFAULT_REPO_BASE"
    local _DEFAULT_BRANCH="$__capacitorjs_DEFAULT_BRANCH"
    local _DEFAULT_LICENSE=""
    local _DEFAULT_AUTHOR="$__capacitorjs_DEFAULT_AUTHOR"
    local _DEFAULT_DEV_BROWSER_PORT="$__capacitorjs_DEFAULT_DEV_BROWSER_PORT"
    local _DEFAULT_EMAIL="$__capacitorjs_DEFAULT_EMAIL"

    local _APP_NAME=$(get.app-name "my-app")
    local _NORMALISED_APP_NAME=$(normalise.package-id $_APP_NAME)
    local _GIT_BASE_URL="${_BASE_REPO_URL}/${_NORMALISED_APP_NAME}"

    local _PACKAGE_ID=$(get.package-id $_BASE_REPO_URL $_APP_NAME)
    local _HOMEPAGE_URL=$(get.home-page-url "$_GIT_BASE_URL")
    local _REPO_URL=$(get.repo-url "$_GIT_BASE_URL")
    local _BRANCH=$(get.repo-branch "$_DEFAULT_BRANCH")
    local _README_URL=$(get.read-me-url "$_GIT_BASE_URL")
    local _BUGS_URL=$(get.bugs-url "$_GIT_BASE_URL")
    local _LICENSE=$(get.license "$_DEFAULT_LICENSE")
    local _AUTHOR=$(get.author "$_DEFAULT_AUTHOR")
    local _EMAIL=$(get.email "$_DEFAULT_EMAIL")
    local _DESCRIPTION=$(get.description "Give a short description of what $_APP_NAME does")
    local _DEV_BROWSER_PORT=$(get.broswer-port "$_DEFAULT_DEV_BROWSER_PORT")
    local _TYPE=$(get.type)


    capacitorjs.import.scaffolding

    capacitorjs.install.npm \
        "${_APP_NAME}" \
        "${_TYPE}" \
        "${_REPO_URL}" \
        "${_BUGS_URL}" \
        "${_HOMEPAGE_URL}" \
        "${_LICENSE}"

    capacitorjs.install.capacitor \
        "${_APP_NAME}" \
        "${_PACKAGE_ID}"

    capacitorjs.configure.template \
        "$_APP_NAME" \
        "$_DESCRIPTION" \
        "$_AUTHOR" \
        "$_EMAIL" \
        "$_LICENSE"

    capacitorjs.import.dist

    local _TARGET_PLATFORM=$(
        input.select "Select OS" \
            --prefill "1" \
            --options "Android|iOS|Both"
    )

    case $_TARGET_PLATFORM in
        "Android")
            capacitorjs.install.android
        ;;
        "iOS")
            capacitorjs.install.ios
        ;;
        "Both")
            capacitorjs.install.android
            capacitorjs.install.ios
        ;;
    esac

    capacitorjs.configure.gradle

    capacitorjs.configure.npm \
        "$_APP_NAME" \
        "$_VERSION" \
        "$_TYPE" \
        "$_REPO_URL" \
        "$_BUGS_URL" \
        "$_HOMEPAGE_URL" \
        "$_LICENSE"


    capacitorjs.sync.capacitor

    capacitorjs.configure.git \
        "$_REPO_URL" \
        "$_BRANCH"

    console.log "All done. Have a nice day"
}