Skip to content

Instantly share code, notes, and snippets.

@vitapluvia
Created January 29, 2015 10:15
Show Gist options
  • Save vitapluvia/0814a1bab0c448bf0460 to your computer and use it in GitHub Desktop.
Save vitapluvia/0814a1bab0c448bf0460 to your computer and use it in GitHub Desktop.
Simple Shell v1
#!/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