# easy-terminal
**A library that help you to convert function into terminal command**
## Getting started
1. [**Installation**](#installation)
2. [**Usages**](#usages)
3. [**Code example**](#code-example)
4. [**Documentation**](#documentation)
## Installation
#### `pip install easy-terminal`
##### Require easy-events>=2.2.0
GitHub : [Github](https://github.com/ThePhoenix78/easy-terminal)
## Usages
Add the @terminal() before the function you want to try in the terminal
Use @main() to redirect any input to the function linked
## Code example
```py
from easy_terminal import terminal
help_msg = """
pc processor ram : will print the informations of the pc
hello : will print world
help : will show this message
"""
@terminal(aliases=["help"])
def h():
print(help_msg)
class A:
nb = 1
def __init__(self, nb=5):
self.nb = nb
@terminal()
def hello(self):
print("world", self.nb, "\n")
a = A(6)
@terminal()
async def hello():
print("world\n")
@terminal()
def pc(processor: str = "intel", ram: str = "8go"):
print(f"processor: {processor}\nram : {ram}\n")
@main()
def principal(car: str = "mercedes"):
print(f"Your car is a {car}")
"""
>hello
world
>A.hello
world 1
>a.hello
world 6
>pc
processor: intel
ram : 8go
>pc amd
processor: amd
ram : 8go
>pc amd 16go
processor: amd
ram : 16go
>help
pc processor ram : will print the informations of the pc
hello : will print world
help : will show this message
>peugot
Your car is a peugot
"""
```
### This lib make you run python function in a terminal
Raw data
{
"_id": null,
"home_page": "https://github.com/ThePhoenix78/easy-terminal",
"name": "easy-terminal",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "wrapper,event,terminal,cmd",
"author": "ThePhoenix78",
"author_email": "thephoenix788@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0e/a8/866e4aa1f3ae450d9d84f7e5e0521533515991de69562917eb8ea528ff07/easy-terminal-0.8.1.tar.gz",
"platform": null,
"description": "# easy-terminal\r\n\r\n**A library that help you to convert function into terminal command**\r\n\r\n## Getting started\r\n\r\n1. [**Installation**](#installation)\r\n2. [**Usages**](#usages)\r\n3. [**Code example**](#code-example)\r\n4. [**Documentation**](#documentation)\r\n\r\n## Installation\r\n\r\n#### `pip install easy-terminal`\r\n\r\n##### Require easy-events>=2.2.0\r\n\r\nGitHub : [Github](https://github.com/ThePhoenix78/easy-terminal)\r\n\r\n\r\n## Usages\r\n\r\nAdd the @terminal() before the function you want to try in the terminal\r\nUse @main() to redirect any input to the function linked\r\n\r\n## Code example\r\n\r\n```py\r\nfrom easy_terminal import terminal\r\n\r\nhelp_msg = \"\"\"\r\npc processor ram : will print the informations of the pc\r\nhello : will print world\r\nhelp : will show this message\r\n\"\"\"\r\n\r\n@terminal(aliases=[\"help\"])\r\ndef h():\r\n print(help_msg)\r\n\r\nclass A:\r\n nb = 1\r\n\r\n def __init__(self, nb=5):\r\n self.nb = nb\r\n\r\n @terminal()\r\n def hello(self):\r\n print(\"world\", self.nb, \"\\n\")\r\n\r\na = A(6)\r\n\r\n@terminal()\r\nasync def hello():\r\n print(\"world\\n\")\r\n \r\n\r\n@terminal()\r\ndef pc(processor: str = \"intel\", ram: str = \"8go\"):\r\n print(f\"processor: {processor}\\nram : {ram}\\n\")\r\n\r\n\r\n\r\n@main()\r\ndef principal(car: str = \"mercedes\"):\r\n print(f\"Your car is a {car}\")\r\n\r\n\"\"\"\r\n>hello\r\nworld\r\n\r\n>A.hello\r\nworld 1\r\n\r\n>a.hello\r\nworld 6\r\n\r\n>pc\r\nprocessor: intel\r\nram : 8go\r\n\r\n>pc amd\r\nprocessor: amd\r\nram : 8go\r\n\r\n>pc amd 16go\r\nprocessor: amd\r\nram : 16go\r\n\r\n>help\r\n\r\npc processor ram : will print the informations of the pc\r\nhello : will print world\r\nhelp : will show this message\r\n\r\n\r\n>peugot\r\nYour car is a peugot\r\n\"\"\"\r\n\r\n```\r\n\r\n### This lib make you run python function in a terminal\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool that help using python function into terminal",
"version": "0.8.1",
"project_urls": {
"Download": "https://github.com/ThePhoenix78/easy-terminal/tarball/master",
"Homepage": "https://github.com/ThePhoenix78/easy-terminal"
},
"split_keywords": [
"wrapper",
"event",
"terminal",
"cmd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "04a84f15309888b8e58f34f51a52864ad66f03d21b75135938bfcc6c618a0d4d",
"md5": "2c2b79bad464d90509f460bd55374da5",
"sha256": "23a3559a59aabc0c2dc08468f31e4eaace051d4379b97d0c7198d7b33165b64a"
},
"downloads": -1,
"filename": "easy_terminal-0.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c2b79bad464d90509f460bd55374da5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4661,
"upload_time": "2023-09-05T07:44:57",
"upload_time_iso_8601": "2023-09-05T07:44:57.189893Z",
"url": "https://files.pythonhosted.org/packages/04/a8/4f15309888b8e58f34f51a52864ad66f03d21b75135938bfcc6c618a0d4d/easy_terminal-0.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0ea8866e4aa1f3ae450d9d84f7e5e0521533515991de69562917eb8ea528ff07",
"md5": "f85c82272571e27aa4cb95ecf7b19ebf",
"sha256": "bbc75a6d857bc9ba5fd9eb49fbeb4697d65c29367a0ce4f2bf0b4243d68e9638"
},
"downloads": -1,
"filename": "easy-terminal-0.8.1.tar.gz",
"has_sig": false,
"md5_digest": "f85c82272571e27aa4cb95ecf7b19ebf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4387,
"upload_time": "2023-09-05T07:44:58",
"upload_time_iso_8601": "2023-09-05T07:44:58.446285Z",
"url": "https://files.pythonhosted.org/packages/0e/a8/866e4aa1f3ae450d9d84f7e5e0521533515991de69562917eb8ea528ff07/easy-terminal-0.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-05 07:44:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ThePhoenix78",
"github_project": "easy-terminal",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "easy-terminal"
}