Name | InputPowertools JSON |
Version |
1.0.4
JSON |
| download |
home_page | None |
Summary | Kind of like a non intrusive addon for the standard input() |
upload_time | 2025-07-15 21:35:58 |
maintainer | None |
docs_url | None |
author | MAA28 |
requires_python | >=3.0 |
license | None |
keywords |
cli
command line
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# InputPowertools
> Eliminate the annoyances of getting input or building a cli in python!
## Prolog
I love using **c**ommand **l**ine **i**nterfaces and I think most people like building these small tools as well, but its really annoying to have to build the interface between the user and your program, hence I build this python package to take care of this part for you.
## Installation
```shell
$ pip install InputPowertools
```
## Examples
### input()
#### Alpha
```
>>> print(f"Result: {input('Type your name:', Mode.ALPHA)}")
Type your name: >? 123
🛑 Please enter a value that is completely alphabetic (no punctuation, numbers, emojis or nothing)...
Type your name: >? Malte
Result: Malte
```
#### Numeric
```
>>> print(f"Result: {input('How old are you:', Mode.NUMERIC, domain=lambda x: x % 1 == 0)}")
How old are you: >? 😀
🛑 Please enter a number...
How old are you: >? 13.5
🛑 Please enter a value that fits the answers domain...
How old are you: >? 16
Result: 16
```
#### Options
```
>>> print(f"Result: {input('Are you a what kind of person are you?', Mode.OPTIONS, options=['Cat person', 'Dog person', 'Bird person'])}")
Are you a what kind of person are you?
1 -> Cat person
2 -> Dog person
3 -> Bird person
Select option [1-3]: >? Though question
🛑 Please enter a number...
Select option [1-3]: >? 0
🛑 Please enter a value that fits the answers domain...
Select option [1-3]: >? 4
🛑 Please enter a value that fits the answers domain...
Select option [1-3]: >? 2
Result: (1, 'Dog person')
```
### Regex
```
>>> print(f"Result: {input('What is your favorite hex color?', Mode.REGEX, regex=r'(#([a-fA-F0-9]{6}|[a-fA-F0-9]{3}))', regex_description='Hexadecimal Color. Something like #123 or #FF32CD')}")
What is your favorite hex color? >? red
🛑 Please enter a value that fits this description: Hexadecimal Color. Something like #123 or #FF32CD
What is your favorite hex color? >? #F00
Result: #F00
```
### Defaults
#### Just pressing enter
```
>>> print(f"Result: {input('Type your name:', Mode.ALPHA, default='Hannes')}")
Type your name: (Hannes) >?
Result: Hannes
```
#### Typing something else
```
>>> print(f"Result: {input('Type your name:', Mode.ALPHA, default='Hannes')}")
Type your name: (Hannes) >? Malte
Result: Malte
```
### Confirm
```
>>> print(f"Result: {input('Type your name:', Mode.ALPHA, confrim=True)}")
Type your name: >? Malte
Do you want to select "Malte"?
1 -> yes
2 -> no
Select option [1-2]: (2) >? 1
Result: Malte
```
## CLI
### Guide
```
$ python examples/example\ 1.py
For more information: examples/example 1.py --help
```
### Analysing the docstring and type hints to generate --help
```
$ python examples/example\ 1.py --help
Some function
A function that is truly amazing... wow!
Return: Some fascinating thing
Options:
--help
Prints out information about the program.
Type: bool
Default: False
--a
Is a variable called a
--b
Is a variable called b
Type: str
--c
Is a variable called c
Type: list
--d
Is a variable called d
Type: bool
Default: False
```
### Analysing the function parameters to generate cli
```
$ python examples/example\ 1.py --a lol --b "this is a value with spaces" --c 4 2 "test123" --d
a='lol' b='this is a value with spaces' c=[4, 2, 'test123'] d=True
```
Raw data
{
"_id": null,
"home_page": null,
"name": "InputPowertools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.0",
"maintainer_email": null,
"keywords": "cli, command line",
"author": "MAA28",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/1c/a3/4a746016f5422d188cfb09930b0708ee024ab4e126950478101d827ddc78/inputpowertools-1.0.4.tar.gz",
"platform": null,
"description": "# InputPowertools\n> Eliminate the annoyances of getting input or building a cli in python!\n## Prolog\nI love using **c**ommand **l**ine **i**nterfaces and I think most people like building these small tools as well, but its really annoying to have to build the interface between the user and your program, hence I build this python package to take care of this part for you.\n## Installation\n```shell\n$ pip install InputPowertools\n```\n## Examples\n### input()\n#### Alpha\n```\n>>> print(f\"Result: {input('Type your name:', Mode.ALPHA)}\")\n\nType your name: >? 123\n\ud83d\uded1 Please enter a value that is completely alphabetic (no punctuation, numbers, emojis or nothing)...\nType your name: >? Malte\nResult: Malte\n```\n#### Numeric\n```\n>>> print(f\"Result: {input('How old are you:', Mode.NUMERIC, domain=lambda x: x % 1 == 0)}\")\n\nHow old are you: >? \ud83d\ude00\n\ud83d\uded1 Please enter a number...\nHow old are you: >? 13.5\n\ud83d\uded1 Please enter a value that fits the answers domain...\nHow old are you: >? 16\nResult: 16\n```\n#### Options\n```\n>>> print(f\"Result: {input('Are you a what kind of person are you?', Mode.OPTIONS, options=['Cat person', 'Dog person', 'Bird person'])}\")\n\nAre you a what kind of person are you? \n1 -> Cat person\n2 -> Dog person\n3 -> Bird person\nSelect option [1-3]: >? Though question\n\ud83d\uded1 Please enter a number...\nSelect option [1-3]: >? 0\n\ud83d\uded1 Please enter a value that fits the answers domain...\nSelect option [1-3]: >? 4\n\ud83d\uded1 Please enter a value that fits the answers domain...\nSelect option [1-3]: >? 2\nResult: (1, 'Dog person')\n```\n### Regex\n```\n>>> print(f\"Result: {input('What is your favorite hex color?', Mode.REGEX, regex=r'(#([a-fA-F0-9]{6}|[a-fA-F0-9]{3}))', regex_description='Hexadecimal Color. Something like #123 or #FF32CD')}\")\n\nWhat is your favorite hex color? >? red\n\ud83d\uded1 Please enter a value that fits this description: Hexadecimal Color. Something like #123 or #FF32CD\nWhat is your favorite hex color? >? #F00\nResult: #F00\n```\n### Defaults\n#### Just pressing enter\n```\n>>> print(f\"Result: {input('Type your name:', Mode.ALPHA, default='Hannes')}\")\n\nType your name: (Hannes) >? \nResult: Hannes\n```\n#### Typing something else\n```\n>>> print(f\"Result: {input('Type your name:', Mode.ALPHA, default='Hannes')}\")\n\nType your name: (Hannes) >? Malte\nResult: Malte\n```\n### Confirm\n```\n>>> print(f\"Result: {input('Type your name:', Mode.ALPHA, confrim=True)}\")\n\nType your name: >? Malte\nDo you want to select \"Malte\"? \n1 -> yes\n2 -> no\nSelect option [1-2]: (2) >? 1\nResult: Malte\n```\n## CLI\n### Guide\n```\n$ python examples/example\\ 1.py\n\nFor more information: examples/example 1.py --help\n```\n### Analysing the docstring and type hints to generate --help\n```\n$ python examples/example\\ 1.py --help\n\nSome function\n A function that is truly amazing... wow!\nReturn: Some fascinating thing\n Options:\n --help\n Prints out information about the program.\n Type: bool\n Default: False\n --a\n Is a variable called a\n --b\n Is a variable called b\n Type: str\n --c\n Is a variable called c\n Type: list\n --d\n Is a variable called d\n Type: bool\n Default: False\n```\n### Analysing the function parameters to generate cli\n```\n$ python examples/example\\ 1.py --a lol --b \"this is a value with spaces\" --c 4 2 \"test123\" --d\n\na='lol' b='this is a value with spaces' c=[4, 2, 'test123'] d=True\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Kind of like a non intrusive addon for the standard input()",
"version": "1.0.4",
"project_urls": {
"Homepage": "https://github.com/MAA28/InputPowertools",
"Issues": "https://github.com/MAA28/InputPowertools/issues"
},
"split_keywords": [
"cli",
" command line"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "13bf46c34720ff157cd425d7a311d9f26b4f2fc6d6407a6d9596ba2fdbc9a0e7",
"md5": "cd16256fa994bfcaa5c30e7f1c40e243",
"sha256": "186b9b34d0664a3840f3852620618d6099319e7730e1075973615f562543407b"
},
"downloads": -1,
"filename": "inputpowertools-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cd16256fa994bfcaa5c30e7f1c40e243",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 6654,
"upload_time": "2025-07-15T21:35:56",
"upload_time_iso_8601": "2025-07-15T21:35:56.662104Z",
"url": "https://files.pythonhosted.org/packages/13/bf/46c34720ff157cd425d7a311d9f26b4f2fc6d6407a6d9596ba2fdbc9a0e7/inputpowertools-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1ca34a746016f5422d188cfb09930b0708ee024ab4e126950478101d827ddc78",
"md5": "8a0fde1f712df6f6529f4c1980bc4004",
"sha256": "fef8347ec7db44165683068906949ea81d658853fdb6e3ddc6f9ca7bbf03885e"
},
"downloads": -1,
"filename": "inputpowertools-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "8a0fde1f712df6f6529f4c1980bc4004",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0",
"size": 9670,
"upload_time": "2025-07-15T21:35:58",
"upload_time_iso_8601": "2025-07-15T21:35:58.344263Z",
"url": "https://files.pythonhosted.org/packages/1c/a3/4a746016f5422d188cfb09930b0708ee024ab4e126950478101d827ddc78/inputpowertools-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-15 21:35:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MAA28",
"github_project": "InputPowertools",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "inputpowertools"
}