hellerbarde / stapler

A small utility making use of the pypdf library to provide a (somewhat) lighter alternative to pdftk
Other
283 stars 53 forks source link

staplelib: normalise output pathnames #83

Closed jonboulle closed 2 years ago

jonboulle commented 3 years ago

When run against e.g. files in the current directory, pdf-stapler has the somewhat ugly habit of injecting path separators; this removes them.


I love this tool and use it all the time, but since the most common use case for me is files in the current PWD, the paths in errors always bother me, so here's a suggestion :)

before:

$ poetry run stapler cat in.pdf ./out.pdf
Error: File already exists: .//./out.pdf
$ poetry run stapler cat in.pdf out.pdf
Error: File already exists: .//out.pdf

after:

$ poetry run stapler cat in.pdf ./out.pdf
Error: File already exists: out.pdf
$ poetry run stapler cat in.pdf out.pdf
Error: File already exists: out.pdf