
# x ccmd --convert meta.yml meta.json x y2j meta.yml meta.json
# x ccmd --convert meta.yml meta.json -- x y2j meta.yml meta.json

# INPUT="$HOME/hello meta.yml"; CACHE="$HOME/hello meta.json"; x ccmd --convert $INPUT $CACHE eval "x y2j <\"\$INPUT\" >\"\$CACHE\""

___x_cmd_ccmd___convert(){
    local src="$1"
    local dst="$2"
    shift 2

    [  "$src" -ot "$dst" ] || {
        x rmrf "$dst"
        [ "$1" != -- ] || shift
        "$@"
    }
}

___x_cmd_ccmd___handle(){
    local src="$1"
    # //
    local dst="$___X_CMD_ROOT_TMP/$src"
    shift 1

    if [  "$src" -ot "$dst" ]; then
        ___x_cmd_cmds_cat "$dst"
    else
        x rmrf "$dst"
        x ensuredir "$dst"
        [ "$1" != -- ] || shift
        "$@" | command tee "$dst"
    fi
}
