1ffe3c632Sopenharmony_civar pbjs = require("./protobuf.js/cli").pbjs 2ffe3c632Sopenharmony_ci 3ffe3c632Sopenharmony_civar argv = []; 4ffe3c632Sopenharmony_civar protoFiles = []; 5ffe3c632Sopenharmony_civar prefix = ""; 6ffe3c632Sopenharmony_ciprocess.argv.forEach(function(val, index) { 7ffe3c632Sopenharmony_ci var arg = val; 8ffe3c632Sopenharmony_ci if (arg.length > 6 && arg.substring(arg.length - 6) == ".proto") { 9ffe3c632Sopenharmony_ci protoFiles.push(arg); 10ffe3c632Sopenharmony_ci } else if (arg.length > 15 && arg.substring(0, 15) == "--include_path=") { 11ffe3c632Sopenharmony_ci prefix = arg.substring(15); 12ffe3c632Sopenharmony_ci } else if (index >= 2) { 13ffe3c632Sopenharmony_ci argv.push(arg); 14ffe3c632Sopenharmony_ci } 15ffe3c632Sopenharmony_ci}); 16ffe3c632Sopenharmony_ciprotoFiles.forEach(function(val) { 17ffe3c632Sopenharmony_ci argv.push(prefix + "/" + val); 18ffe3c632Sopenharmony_ci}); 19ffe3c632Sopenharmony_ci 20ffe3c632Sopenharmony_cipbjs.main(argv, function(err, output){ 21ffe3c632Sopenharmony_ci if (err) { 22ffe3c632Sopenharmony_ci console.log(err); 23ffe3c632Sopenharmony_ci } 24ffe3c632Sopenharmony_ci}); 25ffe3c632Sopenharmony_ci 26