bin/main.js
function dir2TreeStr(){
    argD = Type.isBoolean(argD) ? "./" : trimAndDelQuotes(argD);
    let dirJson,djOpt;
    try{
        djOpt = {
            // preChars:{
            //     directory: ":open_file_folder: ",
            //     file:":page_facing_up: "
            // },
            exclude:{
                outExcludeDir: true //将过滤掉的文件夹输出
            },
            extChars:{
                directory: " /"
            },
            maxDepth: argM
        };
        dirJson = dir2Json(argD, djOpt);
    }catch(e3){
        errorOut("Gen Json via dir failed: " + e3.toString());
        dirJson = false;
    }
    if(!dirJson){
        if(dirJson===null){
            warningOut("The directory '" + argD + "' is empty! (exclude-filter: .git|.svn|.idea|node_modules|bower_components )");
        }
    }else if(Type.isString(dirJson)){
        warningOut("The directory '" + argD + "' is '" + dirJson + "'");
    }else{
        // 间距配置和上面不一样
        s = Type.isNaN(s) ? 2 : s;
        v = Type.isNaN(v) ? 0 : v;
        jsonName = (djOpt.preChars && djOpt.preChars.directory || "") + argD.replace(/\\/g,"/");
        outputVal = false;
        _doMain(dirJson,true);
    }
}
function dir2TreeStr(){
    argD = Type.isBoolean(argD) ? "./" : trimAndDelQuotes(argD);
    let dirJson,djOpt;
    try{
        djOpt = {
            // preChars:{
            //     directory: ":open_file_folder: ",
            //     file:":page_facing_up: "
            // },
            exclude:{
                outExcludeDir: true //将过滤掉的文件夹输出
            },
            extChars:{
                directory: " /"
            },
            maxDepth: argM
        };
        dirJson = dir2Json(argD, djOpt);
    }catch(e3){
        errorOut("Gen Json via dir failed: " + e3.toString());
        dirJson = false;
    }
    if(!dirJson){
        if(dirJson===null){
            warningOut("The directory '" + argD + "' is empty! (exclude-filter: .git|.svn|.idea|node_modules|bower_components )");
        }
    }else if(Type.isString(dirJson)){
        warningOut("The directory '" + argD + "' is '" + dirJson + "'");
    }else{
        // 间距配置和上面不一样
        s = Type.isNaN(s) ? 2 : s;
        v = Type.isNaN(v) ? 0 : v;
        jsonName = (djOpt.preChars && djOpt.preChars.directory || "") + argD.replace(/\\/g,"/");
        outputVal = false;
        _doMain(dirJson,true);
    }
}
function dir2TreeStr ( ) { argD = Type . isBoolean ( argD ) ? "./" : trimAndDelQuotes ( argD ) ; let dirJson , djOpt ; try { djOpt = { // preChars:{ //     directory: ":open_file_folder: ", //     file:":page_facing_up: " // }, exclude : { outExcludeDir : true //将过滤掉的文件夹输出 } , extChars : { directory : " /" } , maxDepth : argM } ; dirJson = dir2Json ( argD , djOpt ) ; } catch ( e3 ) { errorOut ( "Gen Json via dir failed: " + e3 . toString ( ) ) ; dirJson = false ; } if ( ! dirJson ) { if ( dirJson === null ) { warningOut ( "The directory '" + argD + "' is empty! (exclude-filter: .git|.svn|.idea|node_modules|bower_components )" ) ; } } else if ( Type . isString ( dirJson ) ) { warningOut ( "The directory '" + argD + "' is '" + dirJson + "'" ) ; } else { // 间距配置和上面不一样 s = Type . isNaN ( s ) ? 2 : s ; v = Type . isNaN ( v ) ? 0 : v ; jsonName = ( djOpt . preChars && djOpt . preChars . directory || "" ) + argD . replace ( / \\ / g , "/" ) ; outputVal = false ; _doMain ( dirJson , true ) ; } }
convert directory to tree-string
convert directory to tree - string