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.26.2.tar.gz
(19.8 kB
view hashes)
Built Distribution
Close
Hashes for click pathlib-2019.4.26.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12a56d4167a1ad95b0a9810780defda7f12c8eecb7882db467ea45f0b14839fa |
|
MD5 | 81026bf27de310c8b0c15b6a50f816c8 |
|
BLAKE2b-256 | df7c641fe61c754129f982f4d87bd133cccd52bf233a66783c5c5b422220248e |
Close
Hashes for click_pathlib-2019.4.26.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 249e43de467901ff4529f25f467de4d88c992ec55fe9ab6f62003106324fec75 |
|
MD5 | 3a7e1ffc3f6a7d7ab019c7cf923226c8 |
|
BLAKE2b-256 | 3462286d6418fa8b818ac5db2b1f0918294315662590b92cc28da77d31726146 |