import subprocess
import platform
import socket
import time
import sys
import os

path = 'C:/'
host_name = socket.gethostname()
host_ip = socket.gethostbyname(host_name)
print("Seby Terminal - Version 1.0")
while 1<2 :
        code = input(">>> ")
        if code == 'ping' :
                host = input("Ping What Website : ")
                number = input("How Many Times Do I Ping it? : ")

                def ping(host):
                                param = '-n' if platform.system().lower() == 'windows' else '-c'
                                command = ['ping', param, number, host]
                                return subprocess.call(command)
                print(ping(host))
        if code == 'local' :
                        print("Your Local IP Is: " + host_ip)
                        print("Your Local Name Is: " + host_name)
        if code == 'date':
                        print("The Local Date Is: " + time.strftime("%m/%d/%Y"))
        if code == 'list' :
                        dir_list = os.listdir(path)
                        print("Files and Directories in '", path, "' :")
                        print(dir_list)
        if code == 'list -a' :
                file = input("Enter The Direct File Path To Read: ")
                dir_list2 = os.listdir(file)
                print("Files and directories in '", file, "':")
                print(dir_list2)
        if code == 'echo me':
                echo = input("What Do You Want Me To Echo: ")
                print(echo)
        if code == 'exit':
                sys.exit()
        if code =='help' :
                print("""
|******************************************|
|Available Commands:                       |
|help ~ displays list of available commands|
|exit ~ exits Seby Terminal                |
|echo me ~ prints text                     |
|list ~ opens C:\ path as DIR              |
|list -a ~ opens a directory as DIR        |
|date ~ prints the date, year and, month   |
|local ~ tells you your host network info  |
|ping ~ pings a site or IP address         |
|******************************************|
                """)
