• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to make cocoa application run as a command line tool?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to make cocoa application run as a command line tool?


  • Subject: Re: how to make cocoa application run as a command line tool?
  • From: Kai Brüning <email@hidden>
  • Date: Tue, 20 Oct 2009 12:31:56 +0200

The clean solution for this is to refactor your application into a framework, a Cocoa application and a command line tool.

The framework contains all the document logic (the model part of the MVC pattern). Both the Cocoa application and the command line tool use the framework.

The tricky part is probably to find the right border between framework and application/tool. I haven’t done it myself yet, therefore I am for instance not sure whether NSDocument sub classes can/should be part of such a framework.

Others may know whether it is possible/feasible at all to run a Cocoa application faceless.

Good luck
Kai


On 20.10.2009, at 11:58, XiaoGang Li wrote:

Greetings,
I have created an document-based cocoa application, now I need to
provide a command line interface for my users.
for example, users input this into the terminal:
./myApplication.app/Contents/MacOS/myApplication -c --srcFolder "A/B/ C"
--dstFolder "A/B/D";
I can get the argument information through [[NSProcessInfo processInfo]
arguments] in the init method of the application
delegate, and parse the arguments, then step by step.
My question is that, I don't want the window and other document be displayed
on the screen, even the menu.
I want all the action be processed without user's interventio.
Maybe, this feature seems odd. anyway, however, user can open my application
in the Finder, and open a document to edit it. but they
also can run it like a shell command utility to do some other faceless work,
like convert the type the document to another type.


I don't know whether I have a detailed description for my issue, but I will
be very appreciated for your feedback.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >how to make cocoa application run as a command line tool? (From: XiaoGang Li <email@hidden>)

  • Prev by Date: how to make cocoa application run as a command line tool?
  • Next by Date: Re: how to make cocoa application run as a command line tool?
  • Previous by thread: how to make cocoa application run as a command line tool?
  • Next by thread: Re: how to make cocoa application run as a command line tool?
  • Index(es):
    • Date
    • Thread