Forums

Cobra defs script

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Cobra defs script

Postby Charles » Mon Sep 05, 2011 6:35 pm

Here is a little bash script to show all the class, method, etc. definitions in a directory containing Cobra code:
Code: Select all
grep -rnH --color \
   --include='*.cobra' \
   -P '^[ \t]*(namespace|class|interface|struct|mixin|enum|const|var|cue|def|get|set|pro)[ \t]+[A-Za-z0-9_\.]+\b' \
   .

Well actually that should work with any shell as long as you have "grep".

It scans all subdirs as well through the -r option.

This was fairly easy because Cobra declarations always start with "<keyword> <identifier>" such as "class Customer" and "def clear".
Charles
 
Posts: 2510
Location: Los Angeles, CA

Return to Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron