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 7f3a616393a9f633c9258df955860c7ae0d7272d
parent 6cf16c9272612abb264bcb4fbd9a1620dce1b26a
Author: nolash <dev@holbrook.no>
Date:   Sun, 28 Jun 2020 21:43:27 +0200

Add alias on feed create

Diffstat:
Msrc/feedwarrior/cmd/create.py | 4++++
Msrc/feedwarrior/config.py | 1+
Msrc/main.py | 2+-
3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/feedwarrior/cmd/create.py b/src/feedwarrior/cmd/create.py @@ -8,6 +8,7 @@ logg = logging.getLogger(__name__) # TODO: move to submodule asap def parse_args(argparser): + argparser.add_argument('--alias', type=str, help='local common name for log') pass @@ -21,6 +22,9 @@ def execute(config, feed, args): feed_path = os.path.join(config.feeds_dir, str(uu)) os.mkdir(feed_path) os.mkdir(os.path.join(feed_path, 'entries')) + if args.alias != None: + alias_path = os.path.join(config.alias_dir, args.alias) + os.symlink(feed_path, alias_path) feed_meta_path = os.path.join(feed_path, '.log') f = open(feed_meta_path, 'x') diff --git a/src/feedwarrior/config.py b/src/feedwarrior/config.py @@ -29,6 +29,7 @@ class config: self.data_dir = cp['FEEDWARRIOR'].get(['datadir']) self.feeds_dir = os.path.join(self.data_dir, 'feeds') + self.alias_dir = os.path.join(self.feeds_dir, 'names') self.entries_dir = os.path.join(self.data_dir, 'entries') self.hasher = hashlib.sha256 diff --git a/src/main.py b/src/main.py @@ -48,8 +48,8 @@ config = feedwarrior.load_config(args.c) def get_feed_by_name(s): index_path = os.path.join(config.feeds_dir, 'names', s) resolved_path = os.path.realpath(index_path) - logg.debug('attempting to resolve feed with path {}'.format(resolved_path)) os.stat(resolved_path) + logg.debug('feed path {} resolves to {}'.format(index_path, resolved_path)) return os.path.basename(resolved_path) feed_current = None