41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
import argparse
|
|
|
|
# A simple command line app that reads from standard input and writes to standard output
|
|
# Arguments:
|
|
# --input_format=fdb/mars
|
|
# --output_format=text/html
|
|
import sys
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="Generate a compressed tree from various inputs.")
|
|
|
|
parser.add_argument(
|
|
"--input_format",
|
|
choices=["fdb", "mars"],
|
|
default="fdb",
|
|
help="Specify the input format (fdb list or mars)."
|
|
)
|
|
|
|
parser.add_argument(
|
|
"--output_format",
|
|
choices=["text", "html"],
|
|
default="text",
|
|
help="Specify the output format (text or html)."
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
# Read from standard input
|
|
l = 0
|
|
for line in sys.stdin.readlines():
|
|
|
|
|
|
# Process data (For now, just echoing the input)
|
|
output_data = f"[Input Format: {args.input_format}] [Output Format: {args.output_format}]\n{l} lines read from standard input\n"
|
|
|
|
# Write to standard output
|
|
sys.stdout.write(output_data)
|
|
|
|
if __name__ == "__main__":
|
|
main() |