# shellcheck shell=dash disable=1091,2034

___x_cmd_theme_prompt_format(){
    ___x_cmd_theme_ss "$@"
}

# cvs
___x_cmd_theme_ss(){
    case "$1" in
        mini)       ___x_cmd_theme_elmini "$@"  ;;
        *)          ___x_cmd_theme_ssfull "$@"  ;;
    esac
}

xrc:theme:widget msg cwd vcml symbol emoji # hms

___x_cmd_theme_ssfull(){
    local x_;

    ___x_cmd_theme_headline_print

    local X_left
    ___x_cmd_theme_widget_cwd_git
    [ -z "$X_cwd" ] || X_left="${X_cwd}"

    ___x_cmd_theme_widget_emoji
    [ -z "$X_emoji" ] || X_left="${X_emoji}  ${X_left}"
    theme:style_ "%${XTW_vcml_prefix_style}%" "$XTW_vcml_prefix"

    XTW_vcml_prefix="$x_"
    ___x_cmd_theme_widget_vcml
    [ -z "$X_vcml" ] || X_left="${X_left} ${X_vcml}"

    theme:comp exectime
    [ -z "$x_exectime" ] || {
        theme:style_ dim "${x_exectime}"
        X_right="${X_right} ${x_}"
    }

    theme:col2_     "$X_left"   "$X_right"
    printf "%s\n"     "$x_"

    ___x_cmd_theme_widget_symbol "❯" "❯" "❯"
    printf "%s "      "${X_symbol}"
}

XT_transient_ps1(){
    local x_=""
    theme:feature:get transient_time
    case "$x_" in
        always)
            ___x_cmd_theme_comp_transient time
            ___X_CMD_THEME_TIME_H_M_S="$x_"
            ___x_cmd_theme_widget_hms 2>/dev/null
            [ -z "$X_hms" ] || X_ps1="${X_hms} " ;;
    esac

    ___x_cmd_theme_widget_symbol "❯" "❯" "❯" 2>/dev/null
    [ -z "$X_symbol" ] || X_ps1="${X_ps1}${X_symbol} "
}

XTW_vcml_prefix="on "
XTW_vcml_left_label_clean="git:"
XTW_vcml_left_label_dirty="git:"

___x_cmd_theme_linecount_ps1=2

___x_cmd_theme_ss_init(){
    local x_=; theme:feature:get exectime
    case "$x_" in
        never)  ___x_cmd_theme_exectime off ;;
        *)      ___x_cmd_theme_exectime on ;;
    esac
}

___x_cmd_theme_ss_init
