# shellcheck shell=dash

___x_cmd_chat___exec_repl_shortcut___check(){
    local str="$*"
    case "$str" in
        /h|/help|/exit|/quit|/history|/export|/compact|!*) return 0;;
        /*) ___x_cmd_chat_slash_prompt___check "$1" ;;
        *)  return 1 ;;
    esac
}

___x_cmd_chat___exec_repl_shortcut___ls(){
    local prefix="$1"
    local l=""
    {
        printf "%s\n" /h /help /exit /quit /export /compact /history
        ___x_cmd_chat_slash_prompt_ls
    } | while read -r l; do
        printf "${prefix}%s\n" "${l%%"$___X_CMD_UNSEENCHAR_HT"*}"
    done
}

___x_cmd_chat___exec_repl_shortcut___printhelp(){
    printf "%s\n" "
/h|/help        show help
/exit|/quit     exit the loop
/export         export conversation content
/compact        compact conversation history
/history        manage repl history records
"
    ___x_cmd_chat_slash_prompt_ls
    printf "%s\n" "
!<command>     execute the shell command
"
}