any encoding available...

This commit is contained in:
ville rantanen
2018-10-22 22:06:29 +03:00
parent e57a378670
commit 9e98da2e39

View File

@@ -7,22 +7,16 @@ from argparse import ArgumentParser
def setup_options():
parser = ArgumentParser()
parser.add_argument(
"-v",
default = False,
"-v",
default = False,
action = "store_true"
)
parser.add_argument(
"cs",
type = str,
default = "cp437",
type = str,
default = "cp437",
nargs = '?',
choices = [
"ascii",
"cp437",
"cp850",
"cp1250",
"latin1",
]
help = "Character set to show, ex. ascii, cp437, cp850, cp1250, latin1 ..."
)
opts=parser.parse_args()
return opts
@@ -33,12 +27,12 @@ def long_format(table):
for y,row in enumerate(col):
bc.posprint(
y + 2,
1 + x*7,
1 + x*7,
bc.color_string(
"${c}%03d: ${G}%s${Z}"%( row )
)
)
def short_format(table):
bc = ansi.code()
@@ -46,7 +40,7 @@ def short_format(table):
for y,row in enumerate(col):
bc.posprint(
x + 3,
y * 2 + 1,
y * 2 + 1,
bc.color_string(
"${G}%s${Z}"%( row[1], )
)
@@ -65,7 +59,8 @@ if __name__ == "__main__":
table.pop(0)
bc = ansi.code()
bc.clear()
print(bc.color_string("="*20 + " ${Y}%s${Z} "%( opts.cs, ) + "="*20))
lines = int(32 - len(opts.cs)/2 - 2)
print(bc.color_string("="*lines + " ${Y}%s${Z} "%( opts.cs, ) + "="*lines))
if opts.v:
long_format(table)
else: