aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-07-27 01:26:00 +0200
committerMattias Andrée <maandree@operamail.com>2013-07-27 01:26:00 +0200
commit99934097ef803899a09e763088a0a156a173c59e (patch)
tree474d930ee3fa5026f584a1972aa28e9f85fab3a2 /src
parentadd support for the rat in xterm-compatible terminals (diff)
downloadpytagomacs-99934097ef803899a09e763088a0a156a173c59e.tar.gz
pytagomacs-99934097ef803899a09e763088a0a156a173c59e.tar.bz2
pytagomacs-99934097ef803899a09e763088a0a156a173c59e.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/featherweight.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/featherweight.py b/src/featherweight.py
index 6fe219e..e142e51 100755
--- a/src/featherweight.py
+++ b/src/featherweight.py
@@ -32,6 +32,11 @@ old_stty = old_stty.decode('utf-8', 'error')[:-1]
Popen('stty -icanon -echo'.split(' '), stdout = PIPE, stderr = PIPE).communicate()
+args = sys.argv[1:]
+update = '--update' in args
+system = '--system' in args
+
+
home = os.environ['HOME']
root = '%s/.featherweight' % home
if not os.path.exists(root):
@@ -45,9 +50,34 @@ with touch('%s/feeds' % root) as feeds_flock:
if len(feeds) == 0:
feeds = '[]'
feeds = eval(feeds)
+
+ if update:
+ group = None
+ for arg in args:
+ if not arg.startswith('-'):
+ group = arg
+ break
+
+ def update_feed(feed, if_group):
+ if 'inner' in feed:
+ for feed in feed['inner']:
+ update_feed(feed, if_group)
+ elif (if_group is None) or (feed['group'] == if_group):
+ pass # TODO update feed
+
+ for feed in feeds:
+ update_feed(feed, group)
+
+ updated = str(feeds)
+ with open('%s/feeds' % root, 'wb') as file:
+ file.write(updated.encode('utf-8'))
+
unflock(feeds_flock)
+if system:
+ sys.exit(0)
+
print('\033[?1049h\033[?25l\033[?9h', end = '')
try: