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.1.tar.gz
(19.8 kB
view hashes)
Built Distribution
Close
Hashes for click-pathlib-2019.4.30.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0f163ae33de838650543e4127ff979b81c848ee7f1756cb1a59063a6964655a |
|
MD5 | a5bc17930361cca37d6bb00102ea7be6 |
|
BLAKE2b-256 | 0726e08257525d46733d6623e262ee812270ed3920da64ee8bd4e2b6519eabe4 |
Close
Hashes for click_pathlib-2019.4.30.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b2772dfb3647cf313e753fa8dae3cf89d06d9c6933739e58a1450722cfd5312 |
|
MD5 | 81508f55b3631588ce035ad934e54f9a |
|
BLAKE2b-256 | c64e4c9c86b6022b49041bc191f84fb88214e956c0796e414ecd14bf3b92499d |