Using oxygen from the command line
I spend a lot of time at the command line, and I always end up doing stupid things like trying to edit XML files in SubEthaEdit or, worse, nano. It’s stupid, because I’ve got this gigantic, fully-featured XML editor on my desktop. But because it’s less mental effort to type “see foo.xml” than to go to my Dock, click Oxygen and then navigate the OS X tree to find it, I never bother.
Today I thought I may as well set up bash to let me edit stuff in Oxygen. On the Mac, Oxygen has a shell script - ‘oxygenMac.sh’ - but it does some silly crap with the current working directory.
I’ve written a script called oxygen.py which you should be able to use. To install it, put it in ~/bin or wherever else you run your scripts from.
I’ve edited my .bash_profile to add an alias:
alias oxygen="python /Users/tom/code/oxygen.py "
You can use this from the command line in two ways:
oxygen [filename]
or by piping in data as STDIN
If you specify a filename, Oxygen will open that file. If you do not specify a filename, STDIN will be read in to a temporary file, and that will be opened in Oxygen.
Total programming time? Half an hour or so. Amount of time saved? Quite a lot, hopefully.