# shellcheck    shell=dash

xrc param

___x_cmd log init scotty

xrc:mod:lib scotty      ws mod/index     test verify migrate nv

___x_cmd_scotty___main(){
    [ "$#" -gt 0 ] ||   set - nv
    param:advise scotty
    param:subcmd ___x_cmd_scotty            \
        init        "init"                  \
        verify      "verify"                \
        test        "test"                  \
        mod         "modules"               \
        ws          "workspace"             \
        bug         "bug report"            \
        has         "exist subcmd"          \
        yml         "yml for release"       \
        log         "log collect"           \
        info        "Show environment system information"      \
        nv          "Interactive show environment system information" \
        migrate     "migrate the local directory"
    param:subcmd:try
    param:run

    ___x_cmd_scotty help
    return 1
}

___x_cmd_scotty_has(){
    param:void
    case "$1" in
        init|mod|ws|bug|has|log|help|-h)        return 0
    esac
    return 1
}
___x_cmd_scotty_yml(){
    param:void
    case "$1" in
        y2j|yml2json) shift; ___x_cmd y2j "$@" ;;
        j2y|json2yml) shift; ___x_cmd j2y "$@" ;;
        *)            return 1 ;;
    esac
}

___x_cmd_scotty_init(){ param:void ; }
___x_cmd_scotty_bug(){  param:void ; }
___x_cmd_scotty_log(){  param:void ; }
___x_cmd_scotty_help(){
    ___x_cmd help -m scotty "$@" >&2
    return 1
}

