Esempio n. 1
0
    for n,v in pl:
        if n == name:
            return v
    return None

def lines2cli(s):
    '''
    Convert a string into a list of lines. Replace continuation
    characters. Strip white space, left and right. Drop empty lines.
    '''
    cl = []
    l = s.split('\n')
    cum = []
    for p in l:
        p = p.strip()
        if p.endswith('\\'):
            p = p.rstrip('\\')
            cum.append(p)
        else:
            cum.append(p)
            cl.append(''.join(cum).strip())
            cum = []
    if cum: # in case s ends with backslash
        cl.append(''.join(cum))
    return [x for x in cl if x]

user_prefs = UserPrefs.getInstance()
options = Options.getInstance()
vars = Vars.getInstance()
# vim:ts=4:sw=4:et:
    def otherword(self, n, s):
        if "color" in user_prefs.output:
            return self.colorstring(n, s)
        else:
            return s

    def id(self, s):
        return self.otherword(1, s)

    def attr_name(self, s):
        return self.otherword(2, s)

    def attr_value(self, s):
        return self.otherword(3, s)

    def rscref(self, s):
        return self.otherword(4, s)

    def idref(self, s):
        return self.otherword(4, s)

    def score(self, s):
        return self.otherword(5, s)


user_prefs = UserPrefs.getInstance()
vars = Vars.getInstance()
termctrl = TerminalController.getInstance()

# vim:ts=4:sw=4:et: