GithubHelp home page GithubHelp logo

cocoa-interpreter's Introduction

cocoa-interpreter

cocoa-interpreter allows you to use objective C as a shell scripting language.

so you can write scripts like the included DemoScript that dont need an include of cocoa, a main function or an autoreleasepool (thanks to ARC you dont need to worry about retsin/release for cocoa objects):

#!cocoa-interpreter

//check params
if(args.count != 1) {
    NSLog(@"This DemoScript need to be given a path to a PNG file thats 512x512 which it turns into an icns file"); 
    return -1;
}
    
//print all command line args (the args array is automatically set)
NSArray *testArray = [args copy];
for(id s in testArray) {
    NSLog(@"arg: %@",s);
}

...

//use filemgr
id attribs =  [[NSFileManager defaultManager] attributesOfItemAtPath:programPath error:nil];
NSDate *modDate = [attribs fileModificationDate];

//run alert
NSUInteger ret = NSRunAlertPanel(@"modDat"e, [modDate description], @"OK", nil, nil);

//convert img to icon
...	

##installation and usage

The included installer package (under Downloads) will copy the 64bit executable of cocoa-interpretr to /usr/bin/ so that in shell scripts we can reference it as a shell interpreter. IF you move it to a different path, you have to specify that path in your script. e.g.:

#!/usr/local/bin/cocoa-interpreter

Alternatively you can also invoke it and pass it a path TO a script

~:: cocoa-interpreter <PATH_TO_FILE>

##license the code is available under the MIT license

cocoa-interpreter's People

Contributors

daij-djan avatar

Stargazers

Jeffrey Mvutu Mabilama avatar Stone Zhang avatar Peter Jenkins avatar Dat Nguyen avatar Alexey Aleshkov avatar  avatar

Watchers

 avatar James Cloos avatar

Forkers

mralexgray

cocoa-interpreter's Issues

import headers or frameworks in scripts?

Would be possible to just write #import <SomeFWork/SomeFWork.h> within a script and have it actually work? Or possibly somewhere in the source files before the binaries compiled?

Brilliant piece of kit by the way. :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.