fix: scan the current folder when otag scan gets no path
This commit is contained in:
parent
042a60713a
commit
53b495249b
2 changed files with 14 additions and 1 deletions
|
|
@ -567,7 +567,8 @@ class OrvaniTag:
|
|||
|
||||
def scan(self, path: str, recursive: bool=False):
|
||||
|
||||
for (root,dirs,files) in os.walk(path, topdown=True):
|
||||
# os.walk('') yields nothing, so an empty path means the current folder
|
||||
for (root,dirs,files) in os.walk(path or '.', topdown=True):
|
||||
|
||||
# process every file with a reader plugin
|
||||
if self.ENABLE_PLUGINS:
|
||||
|
|
|
|||
|
|
@ -131,3 +131,15 @@ def test_write_uses_config_of_the_files_folder(cwd):
|
|||
|
||||
OrvaniTag().add('sub/doc.pdf', '#lofi')
|
||||
assert OrvaniTag().write_metadata('sub/doc.pdf', 'pdf') == [6, 'pdf']
|
||||
|
||||
|
||||
def test_cmd_scan_defaults_to_current_folder(cwd, monkeypatch):
|
||||
(cwd / 'sub').mkdir()
|
||||
writer = PdfWriter()
|
||||
writer.add_blank_page(72, 72)
|
||||
writer.add_metadata({'/Keywords': '#lofi'})
|
||||
writer.write(cwd / 'sub' / 'doc.pdf')
|
||||
|
||||
monkeypatch.setattr(sys, 'argv', ['otag', 's'])
|
||||
main()
|
||||
assert (cwd / 'sub' / orvani.CONTEXT_FILE).read_text() == 'doc.pdf --- #lofi\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue