'A Python click type which is similar to click.Path but returns a pathlib Path'
Project description
Click Pathlib
A Python click type which is similar to click.Path but returns a Pathlib.Path.
Installation
$ pip install click-pathlib
This supports Python 3.8+.
Usage
Use the click_pathlib.Path just like a click.Path type and your function will receive a pathlib.Path.
import click
import click_pathlib
@click.command('delete')
@click.argument(
'existing_file',
type=click_pathlib.Path(exists=True),
)
def delete(existing_file):
existing_file.unlink()
Credits
Thanks to @jeremyh for describing this solution on GitHub at https://github.com/pallets/click/issues/405#issuecomment-470812067.
Contributing
See CONTRIBUTING.rst.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
click-pathlib-2019.12.28.5.tar.gz
(19.9 kB
view hashes)
Built Distribution
Close
Hashes for click-pathlib-2019.12.28.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f795506dc9e77901347e17bc68dd79a180f692a973a27e1c026f87082308f2b7 |
|
MD5 | 6a95094856e97e5a5aeec755c0529770 |
|
BLAKE2b-256 | 7abdc18f9dbf22081c3039e2b82d748f0f8c3a11fa14d2758a7df699aefb08f6 |
Close
Hashes for click_pathlib-2019.12.28.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae7d452ea7af2ca8e439558bd2bc721981c9679fde0d1879b9eb071919083721 |
|
MD5 | caaa6af24a2201b500450b8f76121300 |
|
BLAKE2b-256 | 482de3fb7b87a2accda99d2a4577873cb68b0d48c9e220e43cea5ec16321fdfa |