From 6a4d48059e6564155e9d870d3408587fb62811db Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 14 May 2017 13:34:35 +0200 Subject: [PATCH] texttoecho --- texttoecho.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 texttoecho.py diff --git a/texttoecho.py b/texttoecho.py new file mode 100644 index 0000000..5fc37b3 --- /dev/null +++ b/texttoecho.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# ************************************************************** +# Convert text to multiple echos +# ************************************************************** +# +# Author: Nick Aliferopoulos +# aliferopoulos@icloud.com +# + +from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter + +class TextToEcho(object): + def __init__(self, prefix, suffix): + self.prefix = prefix + self.suffix = suffix + + def convert(self): + print("Type away! :)") + + final = "" + print "\t", + text = raw_input() + + while(text != ""): + final = final + self.prefix + text + self.suffix + "\n" + print "\t", + text = raw_input() + + print("Done! Here are your echos!") + print("") + print(final) + +def main(): + parser = ArgumentParser(description='Text to Echo', formatter_class = ArgumentDefaultsHelpFormatter) + parser.add_argument('-v', '--version', action = 'version', version = '%(prog)s 1.0') + parser.add_argument('-p', '--prefix', default = 'echo \"', required = False, help = 'Line prefix') + parser.add_argument('-s', '--suffix', default = "\"", required = False, help = 'Line suffix') + args = parser.parse_args() + + tte = TextToEcho(args.prefix, args.suffix) + tte.convert() + +if __name__ == '__main__': + main()