OS X: support the `open` command

Are you missing a feature? Request its implementation here.
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

OS X: support the `open` command

Post by Zearin »

The open command

On OS X, Apple provides a super-handy open command. It’s a versatile command with many, many uses. Check out the manpage for several examples.


One of my favorite uses is this:

Code: Select all

open -a appName
This opens the application appName no matter where it is.

This is super useful if you don’t know the path—or if you don’t want to have to type a really/really/really/long/path . :wink:

Taking that one step further, you can use the command:

Code: Select all

open -a appName [ args… ]
Which open the application and passes it args.


The open command and Oxygen apps

I just tried doing this with DiffFiles:

Code: Select all

open -a DiffFiles file1.xml file2.xml
But it didn’t work. :(


What About DiffFilesMac.sh?

Indeed! It’s a useful script. And I do use it. It works well.

However:
  • it’s a very/long/path/to/my/oxygen/directory
  • open is an OS X provided command that has been around forever. (In fact, it first appeared in NextStep—it’s older than OS X!) It’s powerful, flexible, and it’s not going anywhere.
  • 99% of the time, I can use it to launch any application without typing a path for the application or any arguments. I don’t even have to symlink anything! It “just works”.
I appreciate that Oxygen provides the diffFilesMac.sh script (and friends). It demonstrates that you guys care about usability on the command line as much as in a GUI. So in that spirit, I’d like to officially request taking command-line usability one step further:

Can Oxygen apps please support accepting arguments from the open command? :)
-- Zearin
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: OS X: support the `open` command

Post by adrian »

Hello,

Thank you for the feedback.

I see that this behavior worked at one time(up to Oxygen 11.2), but it seems it was broken starting with v12.0.

I have logged this to our issue tracking tool and it will be investigated and resolved in a future version of Oxygen.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: OS X: support the `open` command

Post by adrian »

Hi,

We've tested this and it works, but DiffFiles and all the other Oxygen tools only accept the file names as arguments(not as files to be opened) and arguments are passed differently to the application by the open command:

Code: Select all

open -a application [--args arg1 ...]
See the open command documentation:
https://developer.apple.com/library/mac ... pen.1.html

On the other hand the main Oxygen apps work directly with the files to be opened:

Code: Select all

open -a Oxygen file1.xml file2.xml
There's also the problem that the file arguments for the tools have to be absolute paths. So you would have to use:

Code: Select all

open -a DiffFiles --args /path/to/file1.xml /path/to/file2.xml
A simple workaround to avoid using the absolute paths is to use pwd instead of the path. e.g.

Code: Select all

open -a DiffFiles --args `pwd`/file1.xml `pwd`/file2.xml
We will investigate and try to remove these limitations in a future version of Oxygen.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply