commit 798fdbd5e8a4be6a6d940cb53c7fc5cca9edb43d
parent 2f81fba0ef78b52a3d2c4c959ef2f21d17502917
Author: nolash <dev@holbrook.no>
Date: Thu, 27 Aug 2020 21:47:35 +0200
Add list feeds subcmd
Diffstat:
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/feedwarrior/cmd/ls.py b/feedwarrior/cmd/ls.py
@@ -0,0 +1,17 @@
+# standard imports
+import os
+
+def parse_args(argparser):
+ pass
+
+
+def check_args(args):
+ pass
+
+
+def execute(config, feed, args):
+ feeds_names_dir = os.path.join(config.feeds_dir, 'names')
+ for f in os.listdir(feeds_names_dir):
+ n = os.path.join(feeds_names_dir, f)
+ r = os.path.realpath(n)
+ print('{} {}'.format(os.path.basename(r), f))
diff --git a/scripts/feedwarrior b/scripts/feedwarrior
@@ -17,6 +17,7 @@ import feedwarrior
from feedwarrior.cmd import create as cmd_create
from feedwarrior.cmd import entry as cmd_entry
from feedwarrior.cmd import show as cmd_show
+from feedwarrior.cmd import ls as cmd_list
logging.basicConfig(level=logging.ERROR)
logg = logging.getLogger()
@@ -36,6 +37,10 @@ sub_show = sub.add_parser('show', help='view feed log')
cmd_show.parse_args(sub_show)
sub_create = sub.add_parser('create', help='create new feed')
cmd_create.parse_args(sub_create)
+sub_list = sub.add_parser('list', help='list feeds')
+cmd_list.parse_args(sub_list)
+
+
args = argparser.parse_known_args()
args = argparser.parse_args(args[1], args[0])
@@ -73,6 +78,8 @@ if args.command == 'create':
cmd_mod = cmd_create
elif args.command == 'entry':
cmd_mod = cmd_entry
+elif args.command == 'list':
+ cmd_mod = cmd_list
elif args.command == 'show' or args.command == None:
if feed_current == None:
sys.stderr.write('plesae speficy a feed for showing\n')