New: added the option -n to specify the name of the cocoa files generated by objj2objcskeleton

This commit is contained in:
Alexandre Wilhelm
2015-06-01 15:22:56 -07:00
parent 8cc075aff3
commit 3f88e02587
+5 -6
View File
@@ -4,9 +4,7 @@
var FILE = require("file"),
OS = require("os"),
stream = require("narwhal/term").stream,
SLASH_REPLACEMENT = "∕"; // DIVISION SLASH, Unicode: U+2215
stream = require("narwhal/term").stream;
function main(args)
{
@@ -138,16 +136,17 @@ function removeLastSlashIfNecessary(path)
/*
$1 Full project source path
$2 Destination
$-n name of the cocoa files
*/
function parser(args)
{
try
{
var projectBasePath = removeLastSlashIfNecessary(args[1]),
sourcePath = args[0],
var sourcePath = args.shift(),
projectBasePath = removeLastSlashIfNecessary(args.shift()),
outputDirectory = projectBasePath,
baseFilename = [sourcePath lastPathComponent],
baseFilenameWithNoExtension = baseFilename.substring(0, baseFilename.length - 2),
baseFilenameWithNoExtension = args.shift() == "-n" ? args.shift() : baseFilename.substring(0, baseFilename.length - 2),
outputHeaderURL = new CFURL([outputDirectory stringByAppendingPathComponent:baseFilenameWithNoExtension + ".h"]),
outputImplementationURL = new CFURL([outputDirectory stringByAppendingPathComponent:baseFilenameWithNoExtension + ".m"]),
source = FILE.read(sourcePath, { charset: "UTF-8" }),