userinput


Nameuserinput JSON
Version 1.0.22 PyPI version JSON
download
home_pagehttps://github.com/LucaCappelletti94/userinput
SummarySimple python package to handle cli user input.
upload_time2023-12-07 18:48:38
maintainer
docs_urlNone
authorLuca Cappelletti
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Userinput
=========================================================================================
|pip| |downloads|

Simple python package to handle CLI user input.

How do I install this package?
----------------------------------------------
As usual, just download it using pip:

.. code:: shell

    pip install userinput


Available validators
----------------------------------------------
Some commonly used validators are available with the package.

+-------------------+-------------------------------------------------------------------------------------------------------+
| Validator name    | Description                                                                                           |
+===================+=======================================================================================================+
| email             | Check if given input string is a valid email.                                                         |
+-------------------+-------------------------------------------------------------------------------------------------------+
| version_code      | Check if given input string is a valid version code.                                                  |
+-------------------+-------------------------------------------------------------------------------------------------------+
| url               | Check if given input string is a valid URL. Does not check if given URL is online.                    |
+-------------------+-------------------------------------------------------------------------------------------------------+
| human_bool        | Check if given input string is a human Boolean, such as "yes", "y", "true", "si", "no", "n", "false". |
+-------------------+-------------------------------------------------------------------------------------------------------+
| integer           | Check if given input string is a integer numeric value.                                               |
+-------------------+-------------------------------------------------------------------------------------------------------+
| positive_integer  | Check if given input string  is a positive integer numeric value.                                     |
+-------------------+-------------------------------------------------------------------------------------------------------+
| non_empty         | Check if given input string is not empty.                                                             |
+-------------------+-------------------------------------------------------------------------------------------------------+
| hostname          | Check if given input string is a reachable host name.                                                 |
+-------------------+-------------------------------------------------------------------------------------------------------+
| ip                | Check if given input string is a reachable IP address.                                                |
+-------------------+-------------------------------------------------------------------------------------------------------+

Use them as follows:

.. code:: python

    from userinput import userinput

    result = userinput(
        "my_label",
        validator="validator name goes here"
    )

You can also chain validators.
They will be called in the order you provide.

.. code:: python

    from userinput import userinput

    result = userinput(
        "my_label",
        validator=[
            "validator name goes here",
            my_custom_validation_function
        ]
    )


Available sanitizers
-----------------------------------------------
Some commonly used sanitizers are available with the package.

+-------------------+-------------------------------------------------------------------------------------------------------+
| Validator name    | Description                                                                                           |
+===================+=======================================================================================================+
| human_bool        | Cast human Boolean specified above in validators to python Booleans.                                  |
+-------------------+-------------------------------------------------------------------------------------------------------+
| strip             | Remove padding spaces and repeated spaces.                                                            |
+-------------------+-------------------------------------------------------------------------------------------------------+

Use them as follows:

.. code:: python

    from userinput import userinput

    result = userinput(
        "my_label",
        sanitizer="sanitizer name goes here"
    )

You can also chain sanitizers.
They will be called in the order you provide.

.. code:: python

    from userinput import userinput

    result = userinput(
        "my_label",
        sanitizer=[
            "sanitizer name goes here",
            my_custom_sanitification_function
        ]
    )


.. |pip| image:: https://badge.fury.io/py/userinput.svg
    :target: https://badge.fury.io/py/userinput
    :alt: Pypi project

.. |downloads| image:: https://pepy.tech/badge/userinput
    :target: https://pepy.tech/badge/userinput
    :alt: Pypi total project downloads 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LucaCappelletti94/userinput",
    "name": "userinput",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Luca Cappelletti",
    "author_email": "cappelletti.luca94@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bb/4f/113bb1d8584a73614ab119fa9c638cee9929ed13538f86186471330a7c05/userinput-1.0.22.tar.gz",
    "platform": null,
    "description": "Userinput\n=========================================================================================\n|pip| |downloads|\n\nSimple python package to handle CLI user input.\n\nHow do I install this package?\n----------------------------------------------\nAs usual, just download it using pip:\n\n.. code:: shell\n\n    pip install userinput\n\n\nAvailable validators\n----------------------------------------------\nSome commonly used validators are available with the package.\n\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| Validator name    | Description                                                                                           |\n+===================+=======================================================================================================+\n| email             | Check if given input string is a valid email.                                                         |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| version_code      | Check if given input string is a valid version code.                                                  |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| url               | Check if given input string is a valid URL. Does not check if given URL is online.                    |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| human_bool        | Check if given input string is a human Boolean, such as \"yes\", \"y\", \"true\", \"si\", \"no\", \"n\", \"false\". |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| integer           | Check if given input string is a integer numeric value.                                               |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| positive_integer  | Check if given input string  is a positive integer numeric value.                                     |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| non_empty         | Check if given input string is not empty.                                                             |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| hostname          | Check if given input string is a reachable host name.                                                 |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| ip                | Check if given input string is a reachable IP address.                                                |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n\nUse them as follows:\n\n.. code:: python\n\n    from userinput import userinput\n\n    result = userinput(\n        \"my_label\",\n        validator=\"validator name goes here\"\n    )\n\nYou can also chain validators.\nThey will be called in the order you provide.\n\n.. code:: python\n\n    from userinput import userinput\n\n    result = userinput(\n        \"my_label\",\n        validator=[\n            \"validator name goes here\",\n            my_custom_validation_function\n        ]\n    )\n\n\nAvailable sanitizers\n-----------------------------------------------\nSome commonly used sanitizers are available with the package.\n\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| Validator name    | Description                                                                                           |\n+===================+=======================================================================================================+\n| human_bool        | Cast human Boolean specified above in validators to python Booleans.                                  |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n| strip             | Remove padding spaces and repeated spaces.                                                            |\n+-------------------+-------------------------------------------------------------------------------------------------------+\n\nUse them as follows:\n\n.. code:: python\n\n    from userinput import userinput\n\n    result = userinput(\n        \"my_label\",\n        sanitizer=\"sanitizer name goes here\"\n    )\n\nYou can also chain sanitizers.\nThey will be called in the order you provide.\n\n.. code:: python\n\n    from userinput import userinput\n\n    result = userinput(\n        \"my_label\",\n        sanitizer=[\n            \"sanitizer name goes here\",\n            my_custom_sanitification_function\n        ]\n    )\n\n\n.. |pip| image:: https://badge.fury.io/py/userinput.svg\n    :target: https://badge.fury.io/py/userinput\n    :alt: Pypi project\n\n.. |downloads| image:: https://pepy.tech/badge/userinput\n    :target: https://pepy.tech/badge/userinput\n    :alt: Pypi total project downloads \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple python package to handle cli user input.",
    "version": "1.0.22",
    "project_urls": {
        "Homepage": "https://github.com/LucaCappelletti94/userinput"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb4f113bb1d8584a73614ab119fa9c638cee9929ed13538f86186471330a7c05",
                "md5": "0ffcd8d18c7866793adab5521cd8c39d",
                "sha256": "b74ef2221c3749ecfd845763caa4d4f7d5554e4ab5c5828f775f10566b401690"
            },
            "downloads": -1,
            "filename": "userinput-1.0.22.tar.gz",
            "has_sig": false,
            "md5_digest": "0ffcd8d18c7866793adab5521cd8c39d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10356,
            "upload_time": "2023-12-07T18:48:38",
            "upload_time_iso_8601": "2023-12-07T18:48:38.097542Z",
            "url": "https://files.pythonhosted.org/packages/bb/4f/113bb1d8584a73614ab119fa9c638cee9929ed13538f86186471330a7c05/userinput-1.0.22.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-07 18:48:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LucaCappelletti94",
    "github_project": "userinput",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "userinput"
}
        
Elapsed time: 0.18516s