improve printing
This commit is contained in:
parent
e1c2f01256
commit
fc390b3a14
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import importlib
|
import importlib
|
||||||
import sys
|
|
||||||
from parse_command import parse_command
|
|
||||||
|
|
||||||
class Buffer: # all the information about the current file
|
class Buffer: # all the information about the current file
|
||||||
def carat(self):
|
def carat(self):
|
||||||
@ -51,15 +49,25 @@ class Buffer: # all the information about the current file
|
|||||||
self.filename = "" # name of where we'll save the file
|
self.filename = "" # name of where we'll save the file
|
||||||
self.index = 0 # indexing of dot
|
self.index = 0 # indexing of dot
|
||||||
self.dot = self.index - 1 # invalid position to start
|
self.dot = self.index - 1 # invalid position to start
|
||||||
self.modules = {}
|
self.modules = {} # see it.py
|
||||||
self.saved = 1 # bool that says whether or not we have saved the file
|
self.saved = 1 # is buffer saved?
|
||||||
|
|
||||||
def main(buffer, command):
|
def main(buffer, command):
|
||||||
if len(command) == 1:
|
if len(command) == 1:
|
||||||
command = command + list(vars(buffer))
|
command += list(vars(buffer))
|
||||||
for attrib in command[1:]:
|
for attrib in command[1:]:
|
||||||
if attrib in list(vars(buffer)):
|
if attrib in list(vars(buffer)):
|
||||||
print("%s:\t%s" % (attrib, vars(buffer)[attrib]))
|
val = vars(buffer)[attrib]
|
||||||
|
# so self.modules shows as <class 'dict'>
|
||||||
|
if not(type(val) is int or type(val) is str):
|
||||||
|
val = str(type(val))
|
||||||
|
# special case usually for self.delimiter
|
||||||
|
elif val == "\n":
|
||||||
|
val = "<newline>"
|
||||||
|
# only affects it if type(val) is int
|
||||||
else:
|
else:
|
||||||
print("No attribute: %s" % attrib)
|
val = str(val)
|
||||||
|
print("%s:\t%s" % (attrib, val))
|
||||||
|
else:
|
||||||
|
print("No attribute: %s\n" % attrib, end='')
|
||||||
return buffer
|
return buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user