This gets more interesting once we have a way to direct HTML to the preview window. Another thing that would be nice: command execution from URLs, which would allow the references to other man pages to work. But there are -- of course -- security implications to that feature. Perhaps if it only works in the preview window, not system-wide.
ruby -e " def error( message ) %x{osascript <<END tell application "SystemUIServer" activate display dialog "#{message}" end tell END } end
def ask(question, answer = '$TM_SELECTED_TEXT') %x{osascript <<END tell application "SystemUIServer" activate display dialog "#{question}" default answer "#{answer}" set answername to text returned of the result do shell script ("/bin/echo " & answername) end tell END} end
error('Xcode tools must be installed to view man pages') if not File.exist?('/Library/Application Support/Apple/Developer Tools/Plug-ins/DocViewerPlugIn.xcplugin/Contents/Resources/rman')
name = ask('Display man page for which command?') name.chomp!
temptemp = %Q{/tmp/tmp.#{name}.`whoami`.TMmantemp} temphtml = %Q{/tmp/tmp.#{name}.`whoami`.html}
%x{man #{name} > #{temptemp}}
# generate HTML and open it if successfully found the entry if not $?.success? then # puts 'No manual entry for ' + name %x{open -a TextMate &} # switch back to TextMate else %x{cat #{temptemp} | "/Library/Application Support/Apple/Developer Tools/Plug-ins/DocViewerPlugIn.xcplugin/Contents/Resources/rman" -fHTML > #{temphtml}} %x{open #{temphtml}} end "
On Jan 13, 2005, at 2:48, Chris Thomas wrote:
This gets more interesting once we have a way to direct HTML to the preview window. Another thing that would be nice: command execution from URLs, which would allow the references to other man pages to work. But there are -- of course -- security implications to that feature. Perhaps if it only works in the preview window, not system-wide.
Ah, nice! And yes, I think I can allow commands in the local HTML window only.
Btw: in case the Xcode plugin is missing you can generate HTML from man using this: GROFF_TYPESETTER=html man >$file -t <something>
But it doesn't look as good as the Xcode plugin, nor does it create links to other sections.
Ever tried bwana (http://www.bruji.com/bwana/)? It's a small application that does exactly this, but also allows for links to other sections and can work from the commandline as well.
Jeroen.
On 13. jan 2005, at 9:05, Jeroen van der Ham wrote:
Ever tried bwana (http://www.bruji.com/bwana/)? It's a small application that does exactly this, but also allows for links to other sections and can work from the commandline as well.
Hey, this is actually really cool :-).
On 13-01-2005 09:37, Sune Foldager wrote:
On 13. jan 2005, at 9:05, Jeroen van der Ham wrote:
Ever tried bwana (http://www.bruji.com/bwana/)? It's a small application that does exactly this, but also allows for links to other sections and can work from the commandline as well.
Hey, this is actually really cool :-).
Yeah, I like it very much too :)
I got this off the macosxhints.com RSS feed. It's not always really useful, but sometimes you find things in there that are really useful.
Jeroen.