# Commander
> A very simple tool to create beautiful console application by using native argparse.
| Project | Commander |
|---------------|--------------------------------------------------|
| Author | Özcan Yarımdünya |
| Documentation | https://ozcanyarimdunya.github.io/commander_py/ |
| Source code | https://github.com/ozcanyarimdunya/commander_py/ |
`commander` is a library that you can create beautiful class based cli application by using `argparse`.
## Installation
Works on `python3+` with no extra dependencies.
```shell
pip install commander-py
```
## Usage
**example.py**
```python
#!/usr/bin/env python3
from commander_py import Application
from commander_py import Command
class GreetCommand(Command):
name = "greet"
help = "Greeting a person"
def add_arguments(self, parser):
parser.add_argument("name", help="Person name")
def handle(self, **arguments):
print("Greeting, ", arguments.get("name"))
if __name__ == '__main__':
app = Application(description="A simple commander application")
app.add_argument("-V", "--version", action="version", version="1.0.0")
app.add_commands(
GreetCommand(),
)
app.run()
```
If we run we get such output.
![gif](./docs/images/1.gif)
For more checkout [tutorials.](https://ozcanyarimdunya.github.io/commander_py/tutorial/)
## LICENSE
```text
MIT License
Copyright (c) 2023 yarimdunya.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
Raw data
{
"_id": null,
"home_page": "https://ozcanyarimdunya.github.io/commander_py/",
"name": "commander-py",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "commander,argparse",
"author": "\u00d6zcan Yar\u0131md\u00fcnya",
"author_email": "ozcanyd@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ea/08/93ee34001a3bcc7208e47b4e8974b8bd1ae61c387da896b6de3c9b466bdc/commander_py-2.0.2.tar.gz",
"platform": null,
"description": "# Commander\n\n> A very simple tool to create beautiful console application by using native argparse.\n\n| Project | Commander |\n|---------------|--------------------------------------------------|\n| Author | \u00d6zcan Yar\u0131md\u00fcnya |\n| Documentation | https://ozcanyarimdunya.github.io/commander_py/ |\n| Source code | https://github.com/ozcanyarimdunya/commander_py/ |\n\n`commander` is a library that you can create beautiful class based cli application by using `argparse`.\n\n## Installation\n\nWorks on `python3+` with no extra dependencies.\n\n```shell\npip install commander-py\n```\n\n## Usage\n\n**example.py**\n\n```python\n#!/usr/bin/env python3\nfrom commander_py import Application\nfrom commander_py import Command\n\n\nclass GreetCommand(Command):\n name = \"greet\"\n help = \"Greeting a person\"\n\n def add_arguments(self, parser):\n parser.add_argument(\"name\", help=\"Person name\")\n\n def handle(self, **arguments):\n print(\"Greeting, \", arguments.get(\"name\"))\n\n\nif __name__ == '__main__':\n app = Application(description=\"A simple commander application\")\n app.add_argument(\"-V\", \"--version\", action=\"version\", version=\"1.0.0\")\n app.add_commands(\n GreetCommand(),\n )\n app.run()\n```\n\nIf we run we get such output.\n\n\n![gif](./docs/images/1.gif)\n\nFor more checkout [tutorials.](https://ozcanyarimdunya.github.io/commander_py/tutorial/)\n\n## LICENSE\n\n```text\nMIT License\n\nCopyright (c) 2023 yarimdunya.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A very simple tool to create beautiful console application by using native argparse.",
"version": "2.0.2",
"split_keywords": [
"commander",
"argparse"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9d39a06facf5871327fdc42cef40ad582d91eaf615a7ef5a959a31c461606d59",
"md5": "6f35e79f71714013914c683b4d005c5f",
"sha256": "18067be271f5af22bebe4eea9ad818aff103f1d891618db8916ce578ef645868"
},
"downloads": -1,
"filename": "commander_py-2.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6f35e79f71714013914c683b4d005c5f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 4252,
"upload_time": "2023-02-01T10:50:13",
"upload_time_iso_8601": "2023-02-01T10:50:13.555020Z",
"url": "https://files.pythonhosted.org/packages/9d/39/a06facf5871327fdc42cef40ad582d91eaf615a7ef5a959a31c461606d59/commander_py-2.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ea0893ee34001a3bcc7208e47b4e8974b8bd1ae61c387da896b6de3c9b466bdc",
"md5": "fbed3a908c9a0f772387e2a4f9f1ed45",
"sha256": "aa2b842b2ec8cbef782c7a3f6792ef305cf9a5b906e5a77fdd4af80f34f587ca"
},
"downloads": -1,
"filename": "commander_py-2.0.2.tar.gz",
"has_sig": false,
"md5_digest": "fbed3a908c9a0f772387e2a4f9f1ed45",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 3686,
"upload_time": "2023-02-01T10:50:14",
"upload_time_iso_8601": "2023-02-01T10:50:14.969503Z",
"url": "https://files.pythonhosted.org/packages/ea/08/93ee34001a3bcc7208e47b4e8974b8bd1ae61c387da896b6de3c9b466bdc/commander_py-2.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-01 10:50:14",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "commander-py"
}