Files @ 3d1112a894df
Branch filter:

Location: light9/flax/add_sub

Drew Perttula
drag subs from KC into CC to make a new subterm (if needed) and curve and some points that turn the sub on right now. some bugs about adding a subterm more than once
Ignore-this: 2c90a5d00c667ea38f23b0e6b36061dc
#!/usr/bin/env python
# usage: add_sub [-l sublevel] subname subterms_to_add_to

from optparse import OptionParser

parser = OptionParser()
parser.add_option('-l', '--level', default='0')
opts, args = parser.parse_args()
print 'debug', opts, args

sub = args.pop(0)
print "adding '%s' at %s" % (sub, opts.level)

for subterm in args:
    print "subterm", subterm
    print
    filename = 'subterms/%s' % subterm
    subs = [line.split(None, 1)[0] for line in file(filename).readlines()]
    if sub not in subs:
        f = file(filename, 'a')
        print 'appended!'
        print >>f, "%s %s" % (sub, opts.level)