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.0.tar.gz
(19.8 kB
view hashes)
Built Distribution
Close
Hashes for click-pathlib-2019.4.30.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f47aee8a8cccbc11e8486f0375ab647b74c127208c6b7c29bb1c654d7d8bb9c7 |
|
MD5 | 4c3e61b4936a38b5aaae6d691a056aef |
|
BLAKE2b-256 | 047e14727abfbe95463fb74d0aff1ae97777340add68faad4310de8c10ce49ca |
Close
Hashes for click_pathlib-2019.4.30.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b834e20dcb261c82448555a6eb2ccfe6f0a08aba8a828a6254e0ace02f39ea7 |
|
MD5 | 795732b81586bd500430bdcc087f249e |
|
BLAKE2b-256 | 6efc0d4ae18f6614b5cbd8214e91456208c1d8392de2730452d89b2c37dbd1bb |