summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/view.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/scripts/view.py b/scripts/view.py
index b73095c..04928e1 100755
--- a/scripts/view.py
+++ b/scripts/view.py
@@ -49,10 +49,21 @@ class viewer(base.base):
self.parse(arg)
#--------------------
+ # get_data
+ #--------------------
+ def get_data(self, file):
+ F = open(file, "r+")
+ data = yaml.load(F)
+ F.close()
+ return data
+
+ #--------------------
# make_one
# for --oneline
#--------------------
- def make_one(self, file, data):
+ def make_one(self, file):
+
+ data = self.get_data(file)
if (len(self.text) > 0):
self.text += "\n"
@@ -66,7 +77,9 @@ class viewer(base.base):
# make_full
# for normal
#--------------------
- def make_full(self, file, data):
+ def make_full(self, file):
+
+ data = self.get_data(file)
if (len(self.text) > 0):
self.text += "\n"
@@ -98,14 +111,10 @@ class viewer(base.base):
#--------------------
def show(self):
for f in self.files:
- F = open(f, "r+")
- data = yaml.load(F)
- F.close()
-
if (self.one_line):
- self.make_one(f, data)
+ self.make_one(f)
else:
- self.make_full(f, data)
+ self.make_full(f)
# escape " -> \"
# otherwise " will be disappeared