<div align=center>
<img src="https://raw.githubusercontent.com/HIT-ReFreSH/PyMobileSuit/main/logo.png" width = 30% height = 30% />
</div>
# ReFreSH.(Py)MobileSuit
![PyPI](https://img.shields.io/pypi/v/PyMobileSuit?style=flat-square)
![GitHub](https://img.shields.io/github/license/HIT-ReFreSH/PyMobileSuit?style=flat-square)
![GitHub last commit](https://img.shields.io/github/last-commit/HIT-ReFreSH/PyMobileSuit?style=flat-square)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/HIT-ReFreSH/PyMobileSuit/python-publish.yml?style=flat-square)
![PyPI - Format](https://img.shields.io/pypi/format/PyMobileSuit?style=flat-square)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/PyMobileSuit?style=flat-square)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/PyMobileSuit?style=flat-square)
![GitHub repo size](https://img.shields.io/github/repo-size/HIT-ReFreSH/PyMobileSuit?style=flat-square)
![GitHub code size](https://img.shields.io/github/languages/code-size/HIT-ReFreSH/PyMobileSuit?style=flat-square)
[View at PyPI](https://pypi.org/project/PyMobileSuit/)
MobileSuit provides an easy way to build Console App quickly. For python.
> This is the python version of [ReFreSH.MobileSuit](https://github.com/HIT-ReFreSH/MobileSuit) (For .NET).
## Setup
```shell script
pip install PyMobileSuit
```
## Usage
There is a quite simple example:
```python
# [Import and Configure]
from ReFreSH.MobileSuit import *
SuitConfig.LOCALE = 'en' # 'zh' or 'en' (default if not set)
# [Write Application Class]
class Hello(object):
def __init__(self):
pass
@SuitInfo("hello")
def instance_func(self):
print("this is instance function")
@SuitInfo("async")
@SuitAlias("async")
async def async_func(self):
print("this is async func")
@SuitInfo("helo <name>")
@SuitAlias("helo")
def func_with_arg(self, name: str):
print(f"this is async func {name}")
@SuitInfo("helos <names>[]")
@SuitAlias("helos")
def func_with_list_arg(self, names: list[str]):
print(f"this is async func {','.join(names)}")
@SuitIgnore
def ignored_func(self):
print("this is func1")
# [Quick Start App]
Suit.QuickStart4BitPowerLine(Hello)
# Suit.QuickStart
# Suit.QuickStartPowerLine
# > type `help` after the prompt.
```
And this is the result:
<div align=center>
<img src="img/pyms-help.png"/>
</div>
### Import and Configure
`from ReFreSH.MobileSuit import *` is ALL YOU NEED normally.
There are two configurations for PyMobileSuit:
- LOCALE: `en` or `zh` to set language.
- THROW: To determine whether Exceptions caught from Application methods should be thrown. To debug your application, you may need to set `THROW=Ture`
### Write Application Class
Free to create your application class, write normal or asynchronous methods with or without parameters. Three basic decorators are available for your application methods:
- `@SuitInfo(expr: str, resourceType=None)`: `expr` is the description of the command shown in `help`command's output by default. If you also set `resourceType`, `getattr(resourceType,expr)` will be the description.
- `@SuitAlias(alias: str)`: Add aliases to the command besides the method name
- `@SuitIgnore`: Suppose the method is not a command.
### Quick Start App
Use `Suit.<QuickStartMethod>(<Your Class>)` to quickly start the application. There are three built-in `QuickStartMethod` implementations:
- Suit.QuickStart: Plain-text IO without powerline.
- Suit.QuickStartPowerLine: True color Powerline supported IO.
- Suit.QuickStart4BitPowerLine: ConsoleColor Powerline supported IO.
Normally, you should use `Suit.QuickStart` or `Suit.QuickStart4BitPowerLine`.
## Notice
Although MobileSuit is easy to use, its features are very comprehensive, so I haven't had the time to write complete documentation.
The current version of PyMobileSuit is migrated from C# using ChatGPT and manual rather than rewritten so that it might be buggy.
Raw data
{
"_id": null,
"home_page": "https://github.com/HIT-ReFreSH/PyMobileSuit",
"name": "PyMobileSuit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "commandline, cli, framework, HIT-ReFreSH",
"author": "Ferdinand Sukhoi",
"author_email": "ferdinandsukhoi@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/ae/d2/c84b15cfc1d1a9515cd1c2331b37306dc76569e7bf751861863cde30ec17/pymobilesuit-0.1.2.tar.gz",
"platform": null,
"description": "<div align=center>\n <img src=\"https://raw.githubusercontent.com/HIT-ReFreSH/PyMobileSuit/main/logo.png\" width = 30% height = 30% />\n</div>\n\n# ReFreSH.(Py)MobileSuit\n\n![PyPI](https://img.shields.io/pypi/v/PyMobileSuit?style=flat-square)\n![GitHub](https://img.shields.io/github/license/HIT-ReFreSH/PyMobileSuit?style=flat-square)\n![GitHub last commit](https://img.shields.io/github/last-commit/HIT-ReFreSH/PyMobileSuit?style=flat-square)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/HIT-ReFreSH/PyMobileSuit/python-publish.yml?style=flat-square)\n![PyPI - Format](https://img.shields.io/pypi/format/PyMobileSuit?style=flat-square)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/PyMobileSuit?style=flat-square)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/PyMobileSuit?style=flat-square)\n![GitHub repo size](https://img.shields.io/github/repo-size/HIT-ReFreSH/PyMobileSuit?style=flat-square)\n![GitHub code size](https://img.shields.io/github/languages/code-size/HIT-ReFreSH/PyMobileSuit?style=flat-square)\n\n[View at PyPI](https://pypi.org/project/PyMobileSuit/)\n\nMobileSuit provides an easy way to build Console App quickly. For python.\n\n> This is the python version of [ReFreSH.MobileSuit](https://github.com/HIT-ReFreSH/MobileSuit) (For .NET).\n\n## Setup\n\n```shell script\npip install PyMobileSuit\n```\n\n## Usage\n\nThere is a quite simple example:\n\n```python\n# [Import and Configure]\nfrom ReFreSH.MobileSuit import *\n\nSuitConfig.LOCALE = 'en' # 'zh' or 'en' (default if not set)\n\n\n# [Write Application Class]\nclass Hello(object):\n def __init__(self):\n pass\n\n @SuitInfo(\"hello\")\n def instance_func(self):\n print(\"this is instance function\")\n\n @SuitInfo(\"async\")\n @SuitAlias(\"async\")\n async def async_func(self):\n print(\"this is async func\")\n\n @SuitInfo(\"helo <name>\")\n @SuitAlias(\"helo\")\n def func_with_arg(self, name: str):\n print(f\"this is async func {name}\")\n\n @SuitInfo(\"helos <names>[]\")\n @SuitAlias(\"helos\")\n def func_with_list_arg(self, names: list[str]):\n print(f\"this is async func {','.join(names)}\")\n\n @SuitIgnore\n def ignored_func(self):\n print(\"this is func1\")\n\n\n# [Quick Start App]\nSuit.QuickStart4BitPowerLine(Hello)\n# Suit.QuickStart\n# Suit.QuickStartPowerLine\n\n# > type `help` after the prompt.\n```\n\nAnd this is the result:\n\n<div align=center>\n <img src=\"img/pyms-help.png\"/>\n</div>\n\n\n### Import and Configure\n\n`from ReFreSH.MobileSuit import *` is ALL YOU NEED normally.\n\nThere are two configurations for PyMobileSuit:\n\n- LOCALE: `en` or `zh` to set language.\n- THROW: To determine whether Exceptions caught from Application methods should be thrown. To debug your application, you may need to set `THROW=Ture`\n\n### Write Application Class\n\nFree to create your application class, write normal or asynchronous methods with or without parameters. Three basic decorators are available for your application methods:\n\n- `@SuitInfo(expr: str, resourceType=None)`: `expr` is the description of the command shown in `help`command's output by default. If you also set `resourceType`, `getattr(resourceType,expr)` will be the description.\n- `@SuitAlias(alias: str)`: Add aliases to the command besides the method name\n- `@SuitIgnore`: Suppose the method is not a command.\n\n### Quick Start App\n\nUse `Suit.<QuickStartMethod>(<Your Class>)` to quickly start the application. There are three built-in `QuickStartMethod` implementations:\n\n- Suit.QuickStart: Plain-text IO without powerline.\n- Suit.QuickStartPowerLine: True color Powerline supported IO.\n- Suit.QuickStart4BitPowerLine: ConsoleColor Powerline supported IO.\n\nNormally, you should use `Suit.QuickStart` or `Suit.QuickStart4BitPowerLine`.\n\n## Notice\n\nAlthough MobileSuit is easy to use, its features are very comprehensive, so I haven't had the time to write complete documentation. \n\nThe current version of PyMobileSuit is migrated from C# using ChatGPT and manual rather than rewritten so that it might be buggy.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An easy way to build python-CLI App quickly, MobileSuit provides an easy way to build Console App quickly. For python.",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/HIT-ReFreSH/PyMobileSuit",
"Repository": "https://github.com/HIT-ReFreSH/PyMobileSuit"
},
"split_keywords": [
"commandline",
" cli",
" framework",
" hit-refresh"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2a6e421bc3bddd8bae0f298a5437eb41e64b4904993c9d6238a555c3d851e37b",
"md5": "0072885194af40a31732b2f88f391443",
"sha256": "ee7c77298d9d80715a4ceabc130fed1ba766988387673236b42c0346881e96a7"
},
"downloads": -1,
"filename": "pymobilesuit-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0072885194af40a31732b2f88f391443",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 48960,
"upload_time": "2024-11-04T16:54:21",
"upload_time_iso_8601": "2024-11-04T16:54:21.713462Z",
"url": "https://files.pythonhosted.org/packages/2a/6e/421bc3bddd8bae0f298a5437eb41e64b4904993c9d6238a555c3d851e37b/pymobilesuit-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aed2c84b15cfc1d1a9515cd1c2331b37306dc76569e7bf751861863cde30ec17",
"md5": "45f29c3c007f3399e2abd4164df82cf4",
"sha256": "dcd3329c049dbabbe0ccb098019fbf3937a8498d849feeed26963e9184f0c619"
},
"downloads": -1,
"filename": "pymobilesuit-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "45f29c3c007f3399e2abd4164df82cf4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 32787,
"upload_time": "2024-11-04T16:54:23",
"upload_time_iso_8601": "2024-11-04T16:54:23.142310Z",
"url": "https://files.pythonhosted.org/packages/ae/d2/c84b15cfc1d1a9515cd1c2331b37306dc76569e7bf751861863cde30ec17/pymobilesuit-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-04 16:54:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HIT-ReFreSH",
"github_project": "PyMobileSuit",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pymobilesuit"
}