diff --git a/it/src/buffer.py b/it/src/buffer.py index 72da5f2..18ac6b1 100755 --- a/it/src/buffer.py +++ b/it/src/buffer.py @@ -10,7 +10,7 @@ class Buffer: # all the information about the current file # Rather than get the content as it's presented in the buffer object # (as one big string), get it as a list. def content_list(self): - return self.content.split(self.delimiter) + return self.content.rstrip(self.delimiter).split(self.delimiter) # Build a string with the same format as the buffer.content and set the # buffer.content to that string, from the kind of list output by @@ -44,8 +44,9 @@ class Buffer: # all the information about the current file return self.content.count(self.delimiter) def __init__(self): - self.content = '' # content of the file - self.delimiter = '\n' # line delimiter + self.content = "" # content of the file + self.delimiter = "\n" # line delimiter + self.env = {} # configuration dictionary self.filename = "" # name of where we'll save the file self.index = 0 # indexing of dot self.dot = self.index - 1 # invalid position to start diff --git a/it/src/config.py b/it/src/config.py new file mode 100644 index 0000000..32021ed --- /dev/null +++ b/it/src/config.py @@ -0,0 +1,10 @@ +def main(buffer, command): + # hard-coded for consistency across multiple people's configs + config_delimiter = "\t" + for i in range(len(buffer.content_list())): + line = buffer.content_list()[i].split(config_delimiter) + if len(line) != 2: + print("%s: %d: Bad column quantity" % (command[0], i+buffer.index)) + else: + buffer.env[line[0]] = line[1] + return buffer diff --git a/it/src/it.py b/it/src/it.py index 8056c36..350ca84 100755 --- a/it/src/it.py +++ b/it/src/it.py @@ -11,7 +11,7 @@ def main(buffer, supplied_command): if supplied_command != [] and len(supplied_command) > 1: command = supplied_command[1:] else: - command = get_command() + command = get_command("") while True: # EOFError in get_command(); ^D @@ -26,7 +26,7 @@ def main(buffer, supplied_command): if type(buffer) is int: break - command = get_command() + command = get_command("") return buffer