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.5+.
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.4.30.2.tar.gz
(19.9 kB
view hashes)
Built Distribution
Close
Hashes for click-pathlib-2019.4.30.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7e82cee61d103f46f588fc9c0421617fe760dc081c2a62f6f8822b1e4a9d8b9 |
|
MD5 | 097a501bd42df2d41240dda060075991 |
|
BLAKE2b-256 | c88ccafb4eef88aee325a9e12f9f51be3a203629cc907ab27ac283a52f9eab44 |
Close
Hashes for click_pathlib-2019.4.30.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8fde39a07f755572009c432db717b4b77f7bb89f441073cedd31be0d64a760b |
|
MD5 | ede90c68afdd4b519c5763c14be11ef3 |
|
BLAKE2b-256 | abcee74fc349b6b11ceb2a68ec81d8d18014336aaa67875ecb039c89921c1b59 |