From dc15c3780a543c7cc5d472ce2beadd272fdbcb3a Mon Sep 17 00:00:00 2001 From: jrtechs Date: Sun, 8 Oct 2017 17:45:27 -0400 Subject: [PATCH] Started working on roo say command --- src/quote.py | 1 - src/roosay.py | 72 ++++++++++++++++++++++++++++++++++++++++++++++ src/ssh_manager.py | 10 +++++-- 3 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 src/roosay.py diff --git a/src/quote.py b/src/quote.py index c364595..2b76728 100644 --- a/src/quote.py +++ b/src/quote.py @@ -32,7 +32,6 @@ def main(): print_cowsay_message(quotes[random.randint(0,(len(quotes) -1))]) - """ Makes sure that other programs don't execute the main """ diff --git a/src/roosay.py b/src/roosay.py new file mode 100644 index 0000000..198d597 --- /dev/null +++ b/src/roosay.py @@ -0,0 +1,72 @@ +""" +Makes sure that other programs don't execute the main +""" + +import sys + +def main(): + """ + + :return: + """ + message = "" + for i in range(1, len(sys.argv)): + message += sys.argv[i] + + roo_say(message) + + +def roo_say(message): + print_message(message) + print_roo() + + +def print_message(message): + print_list, max_len = convert_to_list(message) + + if len(print_list) > 0: + """Print top""" + print(" " + "-" * (max_len + 2)) + + "print middle" + if len(print_list) == 1: + print("< " + print_list[0] + " >") + else: + for i in range(0) + + else: + print("Please pass in a message parameter") + + + + +def convert_to_list(message): + temp_build = "" + temp_return = [] + max_len = 0 + for word in message.split(" "): + if len(temp_build) + len(word) <= 35: + temp_build += word + else: + temp_return.append(temp_build) + if max_len < len(temp_build): + max_len = len(temp_build) + temp_build = word + if len(temp_build) > 0: + temp_return.append(temp_return) + return temp_return, max_len + + +def print_roo(): + print("") + print(" \ /)/)") + print(" \ (ø.ø)") + print(" \ ( />") + print(" __/ _\ //") + print(" '~( '~ )//") + print(" _\ '}/") + print(" \"--~(/") + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/src/ssh_manager.py b/src/ssh_manager.py index 8bb7fe0..b19a05d 100644 --- a/src/ssh_manager.py +++ b/src/ssh_manager.py @@ -53,9 +53,13 @@ def main(): print("*" * len(WELCOME_MESSAGE)) i = input("Enter number of computer to connect to or enter to exit:") - for c in cmp: - if i != '' and int(i) == c.menue_id: - subprocess.call(["ssh", c.host]) + if i == '': + subprocess.call(["clear"]) + else: + for c in cmp: + if int(i) == c.menue_id: + subprocess.call(["ssh", c.host]) + """ Makes sure that other programs don't execute the main