any encoding available...
This commit is contained in:
@@ -7,22 +7,16 @@ from argparse import ArgumentParser
|
|||||||
def setup_options():
|
def setup_options():
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-v",
|
"-v",
|
||||||
default = False,
|
default = False,
|
||||||
action = "store_true"
|
action = "store_true"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"cs",
|
"cs",
|
||||||
type = str,
|
type = str,
|
||||||
default = "cp437",
|
default = "cp437",
|
||||||
nargs = '?',
|
nargs = '?',
|
||||||
choices = [
|
help = "Character set to show, ex. ascii, cp437, cp850, cp1250, latin1 ..."
|
||||||
"ascii",
|
|
||||||
"cp437",
|
|
||||||
"cp850",
|
|
||||||
"cp1250",
|
|
||||||
"latin1",
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
opts=parser.parse_args()
|
opts=parser.parse_args()
|
||||||
return opts
|
return opts
|
||||||
@@ -33,12 +27,12 @@ def long_format(table):
|
|||||||
for y,row in enumerate(col):
|
for y,row in enumerate(col):
|
||||||
bc.posprint(
|
bc.posprint(
|
||||||
y + 2,
|
y + 2,
|
||||||
1 + x*7,
|
1 + x*7,
|
||||||
bc.color_string(
|
bc.color_string(
|
||||||
"${c}%03d: ${G}%s${Z}"%( row )
|
"${c}%03d: ${G}%s${Z}"%( row )
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def short_format(table):
|
def short_format(table):
|
||||||
bc = ansi.code()
|
bc = ansi.code()
|
||||||
@@ -46,7 +40,7 @@ def short_format(table):
|
|||||||
for y,row in enumerate(col):
|
for y,row in enumerate(col):
|
||||||
bc.posprint(
|
bc.posprint(
|
||||||
x + 3,
|
x + 3,
|
||||||
y * 2 + 1,
|
y * 2 + 1,
|
||||||
bc.color_string(
|
bc.color_string(
|
||||||
"${G}%s${Z}"%( row[1], )
|
"${G}%s${Z}"%( row[1], )
|
||||||
)
|
)
|
||||||
@@ -65,7 +59,8 @@ if __name__ == "__main__":
|
|||||||
table.pop(0)
|
table.pop(0)
|
||||||
bc = ansi.code()
|
bc = ansi.code()
|
||||||
bc.clear()
|
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:
|
if opts.v:
|
||||||
long_format(table)
|
long_format(table)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user