summaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-07-20 14:24:08 +0200
committerSanto Cariotti <sancn@live.com>2017-07-20 14:24:08 +0200
commitb34e6c27aa640e4bd4bde91d684e1e59095ba8b1 (patch)
tree14aa4c5b2b384535c6d379143f441625c7039722 /app.py
parentfb3d4d39eded67b145aa17eac72ae85c9793bf67 (diff)
Moved files
Moved all files of lib into a lib dir
Diffstat (limited to 'app.py')
-rw-r--r--app.py64
1 files changed, 0 insertions, 64 deletions
diff --git a/app.py b/app.py
deleted file mode 100644
index ab2f90e..0000000
--- a/app.py
+++ /dev/null
@@ -1,64 +0,0 @@
-from classes import PersonalError, Colors, r, s, host, clear
-from commands import Commands
-from listcommands import ListCommands
-
-class Stout(Commands):
-
- def __init__(self):
- self.name = u'\U0001F37A'
- self.user = Stout.username()
-
- def getName(self):
- word = ' (' + self.name + ') '
- if self.user == '':
- return word
- else:
- return word + Colors.grey + '(' + self.user + ':' + host + ') '
-
- @staticmethod
- def username():
- if r.hget('user:'+host, 'name') is not None:
- return r.hget('user:'+host, 'name').decode('utf-8')
- else:
- return ''
-
- def action(self, cmd):
- if cmd is None:
- return None
- else:
- cmd = cmd.split()
- count = len(cmd)
-
- if (count == 1 or count == 2) and cmd[0] not in ListCommands.commands:
- try:
- if cmd[0] == 'info' and count == 1:
- print(ListCommands.info['info'])
- elif cmd[0] == 'info' and count == 2:
- print(ListCommands.info[cmd[1]][0])
- else:
- raise KeyError
- except (KeyError, IndexError):
- ListCommands.err('keyword')
- else:
- what = cmd[0]
- if what in ListCommands.commands:
- self.command(what, cmd)
- else:
- ListCommands.err('keyword')
-
-
-if __name__ == '__main__':
- clear()
- app = Stout()
- cmd = ''
- while cmd != 'quit':
- try:
- cmd = input('>' + Colors.yellow + app.getName() + Colors.black)
- except EOFError:
- break
-
- app.action(cmd)
- r.save()
-
- s.close()
- clear()