Created
January 29, 2015 10:15
-
-
Save vitapluvia/0814a1bab0c448bf0460 to your computer and use it in GitHub Desktop.
Simple Shell v1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import cmd | |
ASCII = """ | |
.-. . .-. . ..---.. . . | |
( ) o | ( )| || | | .'| | |
`-. . .--.--. .,-. | .-. `-. |---||--- | | . ._| | |
( ) | | | | | )|(.-' ( )| || | | \ / | | |
`-'-' `-' ' `-|`-' `-`--' `-' ' ''---''---''---' `' '---' | |
| | |
""" | |
class CLI(cmd.Cmd): | |
def __init__(self): | |
cmd.Cmd.__init__(self) | |
self.prompt = 'SHELL >> ' | |
def onecmd(self, s): | |
if s in ['quit', 'exit']: | |
exit(0) | |
else: | |
print s | |
def do_EOF(self, s): | |
return True | |
def default(self, line): | |
return | |
try: | |
cli = CLI() | |
cli.cmdloop(ASCII) | |
except: | |
print '' | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment