2019-06-14 02:44:40 +05:30
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
2020-01-12 04:44:35 +05:30
|
|
|
from io import StringIO
|
2019-06-14 02:44:40 +05:30
|
|
|
from optparse import OptionParser
|
|
|
|
|
|
|
|
import damask
|
|
|
|
|
|
|
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|
|
|
scriptID = ' '.join([scriptName,damask.version])
|
|
|
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# MAIN
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
|
|
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [ASCIItable(s)]', description = """
|
|
|
|
Append data of ASCIItable(s) row-wise.
|
|
|
|
|
|
|
|
""", version = scriptID)
|
|
|
|
|
|
|
|
parser.add_option('-a', '--add','--table',
|
|
|
|
dest = 'table',
|
|
|
|
action = 'extend', metavar = '<string LIST>',
|
|
|
|
help = 'tables to add')
|
|
|
|
|
|
|
|
(options,filenames) = parser.parse_args()
|
2019-12-23 02:53:48 +05:30
|
|
|
if filenames == []: filenames = [None]
|
2019-06-14 02:44:40 +05:30
|
|
|
|
|
|
|
if options.table is None:
|
2019-12-23 02:53:48 +05:30
|
|
|
parser.error('no table specified.')
|
2019-06-14 02:44:40 +05:30
|
|
|
|
|
|
|
for name in filenames:
|
2019-12-23 02:53:48 +05:30
|
|
|
damask.util.report(scriptName,name)
|
2019-06-14 02:44:40 +05:30
|
|
|
|
2019-12-23 02:53:48 +05:30
|
|
|
table = damask.Table.from_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
2019-06-14 02:44:40 +05:30
|
|
|
|
2019-12-23 02:53:48 +05:30
|
|
|
for growTable in options.table:
|
|
|
|
table2 = damask.Table.from_ASCII(growTable)
|
|
|
|
table.append(table2)
|
2019-06-14 02:44:40 +05:30
|
|
|
|
2019-12-23 02:53:48 +05:30
|
|
|
table.to_ASCII(sys.stdout if name is None else name)
|