From fcfb3d4083a8e6a7297a559812dee01b82ea8e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfred=20W=C3=A4rns=C3=A4ter?= Date: Thu, 19 Aug 2021 17:31:21 +0200 Subject: [PATCH] added bin dir from dist --- dist/objective-j/bin/cplutil | 90 ++++++++++++++++++++++++++++++++++++ dist/objective-j/bin/objj | 3 ++ dist/objective-j/bin/objjc | 3 ++ 3 files changed, 96 insertions(+) create mode 100755 dist/objective-j/bin/cplutil create mode 100755 dist/objective-j/bin/objj create mode 100755 dist/objective-j/bin/objjc diff --git a/dist/objective-j/bin/cplutil b/dist/objective-j/bin/cplutil new file mode 100755 index 000000000..4d489ab0a --- /dev/null +++ b/dist/objective-j/bin/cplutil @@ -0,0 +1,90 @@ +#!/usr/bin/env narwhal + +var FILE = require("file"), + SYSTEM = require("system"), + OS = require("os"), + ObjectiveJ = require("objective-j"); + +var parser = new (require("narwhal/args").Parser)(); + +parser.usage("file..."); +parser.help("Cappuccino plist converter."); + +parser.option("-c", "--convert", "format") + .help("rewrite property list files in format") + .choices({ + "280north1" : CFPropertyList.Format280North_v1_0, + "xml1": CFPropertyList.FormatXML_v1_0 + }); + +parser.option("-l", "--lint", "lint") + .help("check the property list files for syntax errors") + .set(true); + +parser.option("-h", "--help") + .action(parser.printHelp); + +parser.option("-o", "outPath") + .help("specify alternate file path name for result;\n\ +the -o option is used with -convert, and is only\n\ +useful with one file argument (last file overwrites);\n\ +the path '-' means stdout.") + .set(); + +parser.option("-e", "outExtension") + .help("specify alternate extension for converted files") + .set(); + +parser.option("-s", "silent") + .help("be silent on success") + .set(true); + +exports.main = function(args) +{ + // HACK: add extra "-" to "-convert", etc, for plutil compatibility + var args = args.map(function(arg) { return arg.replace(/^(-[^-].+)$/, "-$1"); }); + var options = parser.parse(args); + + var ok = false; + + if (typeof options.format !== "undefined" || options.lint) + { + ok = true; + options.args.forEach(function(filePath) + { + var plistObject = CFPropertyList.propertyListFromString(FILE.read(filePath, { charset:"UTF-8" })); + + if (!plistObject) + { + SYSTEM.stderr.print("Could not recognize format of plist at " + filePath); + ok = false; + return; + } + + if (options.lint) + { + if (!options.silent) + SYSTEM.stderr.print(filePath + ": OK"); + } + else + { + var string = CFPropertyList.stringFromPropertyList(plistObject, options.format); + + // outextension? + if (options.outPath === "-") + SYSTEM.stdout.write(string); + else + FILE.write(options.outPath || filePath, string, { charset:"UTF-8" }); + } + }); + } + else + { + parser.printHelp(options); + } + + OS.exit(ok ? 0 : 1); +} + +if (require.main == module.id) + exports.main(system.args); diff --git a/dist/objective-j/bin/objj b/dist/objective-j/bin/objj new file mode 100755 index 000000000..a68e90737 --- /dev/null +++ b/dist/objective-j/bin/objj @@ -0,0 +1,3 @@ +#!/usr/bin/env narwhal + +require("objective-j").run(system.args); diff --git a/dist/objective-j/bin/objjc b/dist/objective-j/bin/objjc new file mode 100755 index 000000000..5aad9b190 --- /dev/null +++ b/dist/objective-j/bin/objjc @@ -0,0 +1,3 @@ +#!/usr/bin/env narwhal + +require("objective-j/compiler").main(system.args);