feedwarrior

Slim, portable tooling for creating and distributing decentralized append logs
git clone git://git.defalsify.org/logwarrior.git
Log | Files | Refs | README | LICENSE

commit b819ea3bd47716a7a0408e162b502409f8efb6fc
parent 226309295bb25d3ce7168666e6a16f1dad472339
Author: nolash <dev@holbrook.no>
Date:   Sun, 28 Jun 2020 15:53:49 +0200

Move feed object to package

Diffstat:
Msrc/main.py | 31+++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)

diff --git a/src/main.py b/src/main.py @@ -37,32 +37,19 @@ cp = configparser.ConfigParser() cp.read(args.c) DATA_DIR = cp['FEEDWARRIOR']['datadir'] +cmd = 'log' +if args.command != None: + log.error('invalid command {}'.format(args.command)) + sys.exit(1) + +cmd_mod = None +if cmd == 'log': + from feedwarrior.cmd import log as cmd_mod + try: os.mkdir(DATA_DIR) logg.debug('creating datadir {}'.format(DATA_DIR)) except FileExistsError as e: logg.debug('using datadir {}'.format(DATA_DIR)) - -# TODO: move to submodule asap -feed_parent = None -if args.p != None: - try: - feed_parent = feedwarrior.feed(args.p) - except ValueError as e: - logg.error('invalid parent {}: {}'.format(args.p, e)) - sys.exit(1) - if __name__ == '__main__': - if args.command == None: - feed_current = feedwarrior.feed(parent=feed_parent) - uu = str(feed_current.uuid) - logg.debug('new log {}'.format(uu)) - log_path = os.path.join(DATA_DIR, str(uu)) - os.mkdir(log_path) - - log_meta_path = os.path.join(log_path, '.log') - f = open(log_meta_path, 'x') - json.dump(feed_current.serialize(), f) - f.close() - sys.exit(0)