DISQUS

DISQUS Hello! toxicsoftware.com is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

View man pages in Xcode script

Started by schwa · 10 months ago

I really ought to start blogging again..

So here’s a quick and simple shell script to open Man pages in Xcode. I’ve been using the very nice “manopen” utility to view man pages in a GUI application. But that tool is having difficulties with a cert ... Continue reading »

7 comments

  • Thanks, that's pretty cool. I like the way Xcode's viewer inserts hyperlinks to cross-referenced man pages.

    I have a script I've used for a while that uses PDF rendering of pages-- see http://www.atomicbird.com/blog/2007/07/man-page... to see how it works.
  • I like it. Dueling man page hacks.
  • Great script -- thanks for that!
  • I like the way Xcode’s viewer inserts hyperlinks to cross-referenced man pages.
  • osascript -e ''tell application "XCode" to show document with apple_ref "//apple_ref/doc/man/1/'$1

    should work as well and doesn't require gui scripting. Use "//apple_ref/doc/c_ref/" to show documentation for C code (e.g. Carbon functions and constants; cocoa class names work too).
  • Nico, if that works then very nice.

    But you've just killed my blog post! ;-)
  • Turns out that what I wrote doesn't work with Leopard (it did work with Tiger, though). But the apple_ref scheme is actually documented: http://developer.apple.com/documentation/Develo...

    So to open the "interesting" man page (1) (that's what your script does as well) you can use

    tell application "Xcode" to show document with apple_ref "//apple_ref/c/func/strlen"

    to open the man page for strlen. And

    tell application "Xcode" to show document with apple_ref "//apple_ref/occ/instm/NSArray/initWithArray:copyItems:"

    to show the documentation for -[NSArray initWithArray:copyItems:]. And so on. Semi-useful if you want to use a better editor than xed for code editing, but still look at XCode documentation from there (only semi-useful because you have to guess the top-level link like occ, c etc first before sending the applescript command to xcode).

Add New Comment

Returning? Login