Module: check_mk
Branch: master
Commit: c32a529333a79c5d94dd275c22a20909031ad039
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c32a529333a79c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Nov 29 21:27:36 2011 +0100
figheader: support different languages
---
doc/helpers/figheader | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/doc/helpers/figheader b/doc/helpers/figheader
index ed36a9d..41abf0f 100755
--- a/doc/helpers/figheader
+++ b/doc/helpers/figheader
@@ -1,14 +1,36 @@
#!/usr/bin/python
import os, sys
+
+if sys.argv[1] == '--css':
+ first = "/*-"
+ sep = "+"
+ cont = ""
+ last = "'"
+ end = "*/"
+elif sys.argv[1] == '--c++':
+ first = "// ."
+ cont = "// "
+ sep = "// +"
+ last = "// '"
+ end = "'"
+else:
+ first = "# .-"
+ sep = "# +"
+ cont = "# "
+ last = "# '-"
+ end = "'"
+
+if sys.argv[1].startswith("-"):
+ sys.argv = sys.argv[1:]
+
width = 76
-septop = "# ." + '-' * (width - 6) + '.'
-sepmid = "# +" + '-' * (width - 6) + '+'
-sepbot = "# '" + '-' * (width - 6) + "'"
-print septop
+sepmid = sep + '-' * (width - len(sep) - 1) + '+'
+
+print first + '-' * (width - len(first) - 1) + '.'
for line in os.popen("figlet -c -w %d '%s'" % (width - 7, "
".join(sys.argv[1:])), "r"):
line = line[:-1]
- print ("# |%-" + str(width - 6) + "s|") % line
+ print (cont + "|%-" + str(width - len(cont) - 2) + "s|") % line
print sepmid
-print "# |" + " " * (width - 6) + "|"
-print sepbot
+print cont + "|" + " " * (width - len(cont) - 2) + "|"
+print last + '-' * (width - len(last) - len(end)) + end