From be2ffe95c5a963cee6a07dd70bac2517648be173 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Fri, 25 Sep 2009 17:45:10 -0700 Subject: [PATCH] Added missing bin. Reviewed by me. --- Objective-J/CommonJS/objective-j/bin/cplutil | 79 ++++++++++++++++++++ Objective-J/CommonJS/objective-j/bin/objj | 3 + Objective-J/CommonJS/objective-j/bin/objjc | 3 + 3 files changed, 85 insertions(+) create mode 100755 Objective-J/CommonJS/objective-j/bin/cplutil create mode 100755 Objective-J/CommonJS/objective-j/bin/objj create mode 100755 Objective-J/CommonJS/objective-j/bin/objjc diff --git a/Objective-J/CommonJS/objective-j/bin/cplutil b/Objective-J/CommonJS/objective-j/bin/cplutil new file mode 100755 index 000000000..f9ef478ac --- /dev/null +++ b/Objective-J/CommonJS/objective-j/bin/cplutil @@ -0,0 +1,79 @@ +#!/usr/bin/env narwhal + +var FILE = require("file"); + + +function printUsage() +{ + print("this is where you say the usage"); +} + +function main() +{ + // FIXME: ARGS + system.args.shift(); + + if (system.args.length < 1) + return printUsage(); + + var allFiles = NO, + format = nil, + filePaths = [], + outPath = nil, + outExtension = nil; + + index = 0, + count = system.args.length; + + for (; index < count; ++index) + { + var argument = system.args[index]; + + if (argument.charAt(0) === '-' && !allFiles) + { + if (filePaths.length > 0) + return printUsage(); + + else if (argument === "-convert") + format = system.args[++index]; + + else if (argument === "-o") + outPath = system.args[++index]; + + else if (argument === "-e") + outExtension = system.args[++index]; + + else if (argument === "--") + allFiles = YES; + + else if (argument === "-help") + return printUsage(); + } + else + filePaths.push(system.args[index]); + } + + index = 0; + count = filePaths.length; + + for (; index < count; ++index) + { + var filePath = filePaths[index], + data = new objj_data(); + + data.string = FILE.read(filePaths[index], { charset:"UTF-8" }); + + var plistObject = new CPPropertyListCreateFromData(data); + + if (format === "280north1") + data = CPPropertyListCreate280NorthData(plistObject); + + else if (format === "xml1") + data = CPPropertyListCreateXMLData(plistObject); + + // outextension? + FILE.write(outPath || filePath, data.string, { charset:"UTF-8" }); + } +} + +main(); diff --git a/Objective-J/CommonJS/objective-j/bin/objj b/Objective-J/CommonJS/objective-j/bin/objj new file mode 100755 index 000000000..754efc0b6 --- /dev/null +++ b/Objective-J/CommonJS/objective-j/bin/objj @@ -0,0 +1,3 @@ +#!/usr/bin/env narwhal + +require("objective-j/objj").run(system.args); diff --git a/Objective-J/CommonJS/objective-j/bin/objjc b/Objective-J/CommonJS/objective-j/bin/objjc new file mode 100755 index 000000000..6a3ceadc4 --- /dev/null +++ b/Objective-J/CommonJS/objective-j/bin/objjc @@ -0,0 +1,3 @@ +#!/usr/bin/env narwhal + +require("objective-j/objjc").main(system.args);