I have been working on creating my own command line interface with Python. I am now tweaking it to make it to make different things, like a chatbot.
The script is easily customizable. I have an even shorter basic version:
# -*- coding: utf -*-
# A most basic python command line interface (Customizable!)
# By the tutorial Doctor
# Saturday September 05, 2015
username = 'Tutorial Doctor'
# Main Loop
#------------------------------------------------------------------------------
def Main():
displayCommands()
running=True
while running:
command=raw_input('Type a command %s:'%username).upper()
if command == 'END':
print 'Terminated...'
return False
prompt(command)
#------------------------------------------------------------------------------
# The Shell
#------------------------------------------------------------------------------
def prompt(c):
eraseConsole(c)
#------------------------------------------------------------------------------
# Functions (Your functions here)
#------------------------------------------------------------------------------
import console
def displayCommands():
# Print your custom commands here
print('Console: end,erase')
# If multiple commands mean the same thing, use "in"
def eraseConsole(c):
if c in ['...','ER','ERASE','cls','clear']: # All 5 commands will erase
print('o')
cls
# Call your functions under the prompt() function
#------------------------------------------------------------------------------
Main()
I am wondering about making a UI version. But I am wondering what type of commands would people like to see for Pythonista. If you look at the command line version, it has options like creating files and directories and such.