# shellcheck shell=dash

xrc:mod:lib     grok      model/ls

___x_cmd_grok_model(){
    [ $# -gt 0 ]    ||      set - ls

    local op="$1";  shift
    case "$op" in
        ls|set|get)
            ___x_cmd_grok_model_"$op" "$@"
            ;;
        -h|--help)
            ___x_cmd help -m grok model "$@"
            ;;
    esac
}

___x_cmd_grok_model_set(){
    local model="$1"
    [ -n "$model" ] || {
        grok:error "Please provide a model name"
        return 1
    }

    grok:info "Setting model to $model"
    ___x_cmd_grok_cfg set model="$model"
}

___x_cmd_grok_model_get(){
    local model=""
    ___x_cmd_grok_cur model:=  2>/dev/null
    printf "%s\n" "$model"
}
