Hello!

I'm a new user of Leo. Until I find proper ways to get informations about 
Leo without posting in the mail list have patience with me, please. :)

Was thinking about ways to use Leo and one of those is to make sense of the 
code written by others. I seem to recall reading about this topic 
somewhere, but can't seem to find it again. So, with the scripting 
capabilities in mind, I went to this quest as follows:

@language python


import fnmatch
import os

# the path to scan
rootPath = '/home/tnick/kit/ThirdyPartyCode/octave/octave-3.4.3/src'

# patterns for files to be scanned (a list, maybe? :)
pattern1 = '*.cc'
pattern2 = '*.h'


# locate the node where results shall be deposited
for p in c.all_positions():
    if (p.h == 'files'):
        break;

# todo: clean the node (how?)

# recursive search for files
for root, dirs, files in os.walk(rootPath):
    for filename in fnmatch.filter(files, pattern1):
        print( os.path.join(root, filename))
        child = p.insertAsLastChild()
        child.h = "@auto " + os.path.join(root, filename);
    for filename in fnmatch.filter(files, pattern2):
        print( os.path.join(root, filename))
        child = p.insertAsLastChild()
        child.h = "@auto " + os.path.join(root, filename);

 # todo: nodes in p shall now be iterated and "reload-from-disk" applied to 
> them
>


Is there a better way? How should I go about the todo's?
 
Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/leo-editor/-/MLC9rrCS0j0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to