'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.7.tar.gz
(19.9 kB
view hashes)
Built Distribution
Close
Hashes for click-pathlib-2019.12.28.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9edaf8e92bbe622a62417f2f6a1fb69ad388a9d1d977b7b692dc45d910f37abc |
|
MD5 | e54413463676361a6952813f4459c4e8 |
|
BLAKE2b-256 | 294bf6b7f5db8119e8e501fd693171f4aabc7c74b30573e8ac5e57fdfd756c29 |
Close
Hashes for click_pathlib-2019.12.28.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6b037a05c97fb4d29536b95c2cf50c750fe5413dd6cf1cece119286eba6ae6b |
|
MD5 | 45e492eb7932beba6e138ce8036bbf3d |
|
BLAKE2b-256 | 81b23412631c570878da7930ca2de8bb4847f07822576cf32d94cb8a7e118a60 |