[TxMt] R bundle: Command Usage

Kevin Ballard kevin at sb.org
Sun Dec 24 22:20:29 UTC 2006


What is texscan? I never knew that, so I always just ignored the  
command ;)

I'm not sure the command is necessary, though, as you can get help on  
each function really easily, and if you need a template for args,  
there's always Insert Command Template.

Arguably, this shows the default S3 method args when you give it the  
root, like it shows the args for mean.default when you give it mean,  
but Insert Command Template could always be tweaked to use  
foo.default if you just give it foo (and foo.default exists).

Incidentally, COM=`cat` should work just as well as COM=`tail`. Any  
particular reason to use tail when you don't need the truncating  
abilities of that tool?

On Dec 15, 2006, at 9:18 AM, Hans-Joerg Bibiko wrote:

> Regarding to the R-bundle command 'Command Usage':
>
> I find this idea very good, but it supposes that on every Mac  
> 'texscan' is installed.
>
> So here's my suggestion for it:
>
> 1)
> I don't use Ruby, only Bash with a tiny Perl snippet. It is a bit  
> faster.
>
> 2)
> I'm looking for HTML files, not for tex files.
>
> 3)
> It could happen that the structure of a help file is inconsistent,  
> i.e. no 'Usage' header. If so, now it outputs the first 1100  
> character of the help as plain text. Maybe you find what do you are  
> looking for.
>
> 4)
> I suppressed the error messages coming from the 'find' command  
> mentioning that there is no permission to do something.
>
> Here the code:
>
> ________________
> COM=`tail`
>
> FILES=`find "${R_HOME:-/Library/Frameworks/R.framework/Resources}"/ 
> library -name $COM.html -print 2>/dev/null`
>
> if [ ${#FILES} -eq 0 ]; then
> 	echo "Nothing found for '$COM'"
> 	exit_show_tool_tip
> fi
>
> for F in $FILES
> do
> 	cat "$F" | perl -e '$a="";while(<>){$a.=$_};$a=~m/<h3>Usage<\/h3\> 
> [.|\n]+<pre>(.*?)<\/pre>/sim;if($1){print "Usage:\n".$1;}else{$a=~s/ 
> <.*?>//gms;$a=~s/\n{3,}/\n\n/gms;print substr($a,0,1100)."\n[...]"}'
> done
> __________________
>
>
> Any comments?

-- 
Kevin Ballard
http://kevin.sb.org
kevin at sb.org
http://www.tildesoft.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20061224/e82551ee/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2432 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061224/e82551ee/attachment.p7s>


More information about the textmate mailing list