diff options
author | Juhani Krekelä | 2025-02-16 01:55:25 +0200 |
---|---|---|
committer | Wolfgang Müller | 2025-02-16 12:40:52 +0100 |
commit | 296d89ca56d70638aa51b272a46dfe389fe126c9 (patch) | |
tree | e098f5d47742d372813600c2dedc7e6e92aaac30 /src | |
parent | 11839743dca3673cba07c234262d50639f0b0a06 (diff) | |
download | later-296d89ca56d70638aa51b272a46dfe389fe126c9.tar.gz |
Previously if you wanted to add a local file into the watch_later
entries, you needed to pass the absolute path to it to later(1). Make
later(1) transform a local path into an absolute path as needed.
Diffstat (limited to 'src')
-rw-r--r-- | src/later/cli.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/later/cli.py b/src/later/cli.py index ece41ce..6c369be 100644 --- a/src/later/cli.py +++ b/src/later/cli.py @@ -1,4 +1,5 @@ import getopt +import os import sys from dataclasses import dataclass, field from typing import Protocol @@ -42,12 +43,19 @@ class Arguments: def add_entries(args, entries): for entry in args.rest: + # A watch_later entry for a file must be based on its absolute path. + if os.path.isfile(entry): + entry = os.path.abspath(entry) entries.add(entry) def delete_entries(args, entries): for entry in args.rest: entries.delete(entry) + # Also handle cases where we were given a local path. + # It's always safe to call this, since .delete() ignores non-existent + # entries. + entries.delete(os.path.abspath(entry)) def list_entries(args, entries): |