here is the situation:
Current situation
I have an NSDocument
application (macOS), which works currently only via the Graphical User Interface (GUI). The app is written in Swift 4.
Wished situation
I would like to offer a Commande-Line Interface (CLI) for the app which would take the NSDocument
file (a config file actually) as argument.
The NSDocument
is needed to access the data (stored using Core Data) inside.
When using the app via command-line, the GUI should not be started. The use is either via the GUI, or via the CLI.
What I already know
I think that I should rewrite @NSApplicationMain
to be able to retrieve the app arguments, but I could not find any concrete example in Swift.
Has someone already done something similar and could give me a hint of how to achieve this, in Swift ? Thanks a lot in advance !