semvec/pypi-packages huggingface dataset:
click-pathlib 2020.3.13.0
'A Python click type which is similar to click.Path but returns a pathlib Path'
License: Apache License, Version 2.0
Keywords: click

|Build Status| |codecov| |PyPI|

Click Pathlib
=============

A Python ``click`` type which is similar to ``click.Path`` but returns a ``Pathlib.Path``.

.. contents::

Installation
------------

.. code:: console

   $ 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``.

.. code:: python

   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()

.. _click.Path: https://click.palletsprojects.com/en/7.x/api/#click.Path

Credits
-------

Thanks to `@jeremyh`_ for describing this solution on GitHub at https://github.com/pallets/click/issues/405#issuecomment-470812067.

Contributing
------------

See `CONTRIBUTING.rst <./CONTRIBUTING.rst>`_.

.. |Build Status| image:: https://travis-ci.com/adamtheturtle/click-pathlib.svg?branch=master
   :target: https://travis-ci.com/adamtheturtle/click-pathlib
.. _@jeremyh: https://github.com/jeremyh
.. |codecov| image:: https://codecov.io/gh/adamtheturtle/click-pathlib/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/adamtheturtle/click-pathlib
.. |PyPI| image:: https://badge.fury.io/py/click-pathlib.svg
   :target: https://badge.fury.io/py/click-pathlib