# built documents.
#
# The short X.Y version.
-version = '0.7.1'
+version = '0.7.2'
# The full version, including alpha/beta/rc tags.
-release = '0.7.1'
+release = '0.7.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# Lock for streams
StreamLock = threading.Lock()
-# Commands
-cmdset = [
- 'switch',
- 'trend',
- 'home',
- 'view',
- 'mentions',
- 't',
- 'rt',
- 'quote',
- 'allrt',
- 'fav',
- 'rep',
- 'del',
- 'ufav',
- 's',
- 'mes',
- 'show',
- 'open',
- 'ls',
- 'inbox',
- 'sent',
- 'trash',
- 'whois',
- 'fl',
- 'ufl',
- 'mute',
- 'unmute',
- 'muting',
- 'block',
- 'unblock',
- 'report',
- 'list',
- 'cal',
- 'config',
- 'theme',
- 'h',
- 'p',
- 'r',
- 'c',
- 'q'
-]
-
def parse_arguments():
"""
themes = [f.split('.')[0] for f in files if f.split('.')[-1] == 'json']
g['themes'] = themes
# Startup cmd
- g['previous_cmd'] = ''
+ g['cmd'] = ''
# Semaphore init
c['lock'] = False
c['pause'] = False
pass
+# Command set
+cmdset = [
+ 'switch',
+ 'trend',
+ 'home',
+ 'view',
+ 'mentions',
+ 't',
+ 'rt',
+ 'quote',
+ 'allrt',
+ 'fav',
+ 'rep',
+ 'del',
+ 'ufav',
+ 's',
+ 'mes',
+ 'show',
+ 'open',
+ 'ls',
+ 'inbox',
+ 'sent',
+ 'trash',
+ 'whois',
+ 'fl',
+ 'ufl',
+ 'mute',
+ 'unmute',
+ 'muting',
+ 'block',
+ 'unblock',
+ 'report',
+ 'list',
+ 'cal',
+ 'config',
+ 'theme',
+ 'h',
+ 'p',
+ 'r',
+ 'c',
+ 'q'
+]
+
+# Handle function set
+funcset = [
+ switch,
+ trend,
+ home,
+ view,
+ mentions,
+ tweet,
+ retweet,
+ quote,
+ allretweet,
+ favorite,
+ reply,
+ delete,
+ unfavorite,
+ search,
+ message,
+ show,
+ urlopen,
+ ls,
+ inbox,
+ sent,
+ trash,
+ whois,
+ follow,
+ unfollow,
+ mute,
+ unmute,
+ muting,
+ block,
+ unblock,
+ report,
+ twitterlist,
+ cal,
+ config,
+ theme,
+ help,
+ pause,
+ replay,
+ clear,
+ quit
+]
+
+
def process(cmd):
"""
Process switch
"""
- return dict(zip(
- cmdset,
- [
- switch,
- trend,
- home,
- view,
- mentions,
- tweet,
- retweet,
- quote,
- allretweet,
- favorite,
- reply,
- delete,
- unfavorite,
- search,
- message,
- show,
- urlopen,
- ls,
- inbox,
- sent,
- trash,
- whois,
- follow,
- unfollow,
- mute,
- unmute,
- muting,
- block,
- unblock,
- report,
- twitterlist,
- cal,
- config,
- theme,
- help,
- pause,
- replay,
- clear,
- quit
- ]
- )).get(cmd, reset)
+ return dict(zip(cmdset, funcset)).get(cmd, reset)
def listen():
line = raw_input(g['decorated_name'](c['PREFIX']))
else:
line = raw_input()
- # Save previous cmd in order to compare with readline buffer
- g['previous_cmd'] = line.strip()
- # Get short cmd to filter
+ # Save cmd to compare with readline buffer
+ g['cmd'] = line.strip()
+ # Get short cmd to pass to handle function
try:
cmd = line.split()[0]
except:
cmd = ''
- # Save whold the entire cmd
- g['cmd'] = line
try:
# Lock the semaphore
c['lock'] = True
# after completely delete a word after typing it,
# somehow readline buffer still contains
# the 1st character of that word
- if current_buffer and g['previous_cmd'] != current_buffer:
+ if current_buffer and g['cmd'] != current_buffer:
sys.stdout.write(
g['decorated_name'](c['PREFIX']) + unc(current_buffer))
sys.stdout.flush()