Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#__main__.py

from myinput import myinput


def main():
myinput();

if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print()
print('Shutting down, bye!')
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments.lexers import PythonLexer
from cowpy import cow
from datetime import datetime, timedelta
from pytz import timezone
import pytz

class DoHighlight():
def __init__(self,text):
print(highlight(text,PythonLexer(),TerminalFormatter()))

class DoCowSay():
def __init__(self,text):
msg = cow.milk_random_cow(text)
print(msg)

class DoTime():
def __init__(self,text):
local_date = datetime.now(pytz.timezone(text))
print("{0} {1}".format(local_date.date(), local_date.time()))


Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import argparse
from argparse import *
from commands import *

my_commands = {'highligh':DoHighlight,'cowsay':DoCowSay,'time':DoTime}

def myinput():
parser = argparse.ArgumentParser(description='My example explanation')
parser.add_argument('first',type = str,help = "highligh/cowsay/Time")
parser.add_argument('second',type = str,help = "highligh:Text,cowsay:Text,Time:Region/City")
names = parser.parse_args()

what_do(names)

def what_do(dat):

try:
my_commands[dat.first](dat.second)
except Exception as ex:
_help()
print("Errore!!! first: {0} second: {1}".format(dat.first,dat.second))


def _help():
print("highligh: input python code")
print("cowsay: input text")
print("time: Region/City")


Loading