# FlameWok
_Very tiny framework to quickly create python terminal apps._
The purpose of this package is to get you rid as much as possible
of the tedious part of creating menus, forms, and CLI, and to help to keep the code clean.
## Installation
```sh
pip install flamewok
```
## Create forms
```python
from flamewok import Form
my_form = Form([
("name", "what is your name ?"),
("age", "how old are you ?"),
])
response = my_form.ask()
```
## Create menus
```python
from flamewok import Menu
menu = Menu()
def hello():
print("Hi there ! here is the callback hello !")
menu.ask()
def how():
print("I'm quite fine, thank you :)")
menu.ask()
def exit():
print("Good Bye folks !")
quit()
menu.add_boxes([
"\nChoose an option:\n",
(1, "hello !", hello),
(2, "how are you ?", how),
("x", "exit", exit),
])
menu.ask()
```
yes, that simple !
## Create very quickly a CLI
```python
from flamewok.cli import cli
def main():
print("main program lanched")
def see(*args):
"""the types are defined in the cli.route"""
for arg in args:
print(type(arg), arg)
def multi(*args):
"""the types are not defined in the cli.route, so the args are all str"""
numbers = [float(arg) for arg in args]
result = 1
for num in numbers:
result *= num
print(result)
if __name__ == "__main__":
cli.route(
"This is a CLI test\n", # this will appear in the help
("", main, "Launches the main programm"),
("-h", cli.help, "displays this help"),
("--help", cli.help, 'Idem'),
("see <int:a> <bool:> <str:> <float:>", see, "Show the arguments given in the CLI"),
("multi <some_numbers>", multi, "multiply the numbers"),
)
```
## Fancy titles
```python
from flamewok import big_text
from flamewok import color as c
print(big_text(
"Example", on="@", off=".", spacing=2, underline=True, color=c.success))
# Output (the color can only be seen in a real terminal):
@@@@@...............................@@...........
@....................................@...........
@......@...@...@@@...@@.@...@@@@.....@.....@@@...
@@@@....@.@.......@..@.@.@..@...@....@....@...@..
@........@.....@@@@..@.@.@..@...@....@....@@@@@..
@.......@.@...@...@..@.@.@..@@@@.....@....@......
@@@@@..@...@...@@@@..@.@.@..@.......@@@....@@@...
.................................................
.................................................
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# or with default settings:
print(big_text("Example"))
# Output:
##### ##
# #
# # # ### ## # #### # ###
#### # # # # # # # # # # #
# # #### # # # # # # #####
# # # # # # # # #### # #
##### # # #### # # # # ### ###
```
check the [wiki](https://github.com/byoso/flamewok/wiki) to get a better idea of what you can do.
flamewok, docs and exemples are available here:
https://github.com/byoso/flamewok
Raw data
{
"_id": null,
"home_page": "https://github.com/byoso/flamewok",
"name": "flamewok",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Vincent Fabre",
"author_email": "peigne.plume@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e6/eb/82d0cbaf2c08ab2cbb9ca6ee4a0903250f37b474d844558140985b9c1569/flamewok-1.2.1.tar.gz",
"platform": null,
"description": "# FlameWok\n\n_Very tiny framework to quickly create python terminal apps._\n\nThe purpose of this package is to get you rid as much as possible\nof the tedious part of creating menus, forms, and CLI, and to help to keep the code clean.\n\n\n## Installation\n```sh\npip install flamewok\n```\n\n## Create forms\n```python\nfrom flamewok import Form\n\nmy_form = Form([\n (\"name\", \"what is your name ?\"),\n (\"age\", \"how old are you ?\"),\n ])\n\nresponse = my_form.ask()\n```\n## Create menus\n```python\nfrom flamewok import Menu\n\nmenu = Menu()\n\ndef hello():\n print(\"Hi there ! here is the callback hello !\")\n menu.ask()\n\ndef how():\n print(\"I'm quite fine, thank you :)\")\n menu.ask()\n\ndef exit():\n print(\"Good Bye folks !\")\n quit()\n\nmenu.add_boxes([\n \"\\nChoose an option:\\n\",\n (1, \"hello !\", hello),\n (2, \"how are you ?\", how),\n (\"x\", \"exit\", exit),\n])\n\nmenu.ask()\n\n\n```\n\nyes, that simple !\n\n## Create very quickly a CLI\n\n```python\nfrom flamewok.cli import cli\n\n\ndef main():\n print(\"main program lanched\")\n\n\ndef see(*args):\n \"\"\"the types are defined in the cli.route\"\"\"\n for arg in args:\n print(type(arg), arg)\n\ndef multi(*args):\n \"\"\"the types are not defined in the cli.route, so the args are all str\"\"\"\n numbers = [float(arg) for arg in args]\n result = 1\n for num in numbers:\n result *= num\n print(result)\n\n\nif __name__ == \"__main__\":\n cli.route(\n \"This is a CLI test\\n\", # this will appear in the help\n (\"\", main, \"Launches the main programm\"),\n (\"-h\", cli.help, \"displays this help\"),\n (\"--help\", cli.help, 'Idem'),\n (\"see <int:a> <bool:> <str:> <float:>\", see, \"Show the arguments given in the CLI\"),\n (\"multi <some_numbers>\", multi, \"multiply the numbers\"),\n )\n```\n## Fancy titles\n```python\nfrom flamewok import big_text\nfrom flamewok import color as c\n\nprint(big_text(\n \"Example\", on=\"@\", off=\".\", spacing=2, underline=True, color=c.success))\n\n# Output (the color can only be seen in a real terminal):\n@@@@@...............................@@...........\n@....................................@...........\n@......@...@...@@@...@@.@...@@@@.....@.....@@@...\n@@@@....@.@.......@..@.@.@..@...@....@....@...@..\n@........@.....@@@@..@.@.@..@...@....@....@@@@@..\n@.......@.@...@...@..@.@.@..@@@@.....@....@......\n@@@@@..@...@...@@@@..@.@.@..@.......@@@....@@@...\n.................................................\n.................................................\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n# or with default settings:\n\nprint(big_text(\"Example\"))\n\n# Output:\n##### ##\n# #\n# # # ### ## # #### # ###\n#### # # # # # # # # # # #\n# # #### # # # # # # #####\n# # # # # # # # #### # #\n##### # # #### # # # # ### ###\n\n```\n\n\ncheck the [wiki](https://github.com/byoso/flamewok/wiki) to get a better idea of what you can do.\n\n\n\nflamewok, docs and exemples are available here:\nhttps://github.com/byoso/flamewok\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python micro framework for terminal UI applications",
"version": "1.2.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f53d6b850c764189da410244efc66e01",
"sha256": "95cf74bbfaa1e93dbfc92c7d24178556634acf7088cb8cb9ff2d7707805bdf78"
},
"downloads": -1,
"filename": "flamewok-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f53d6b850c764189da410244efc66e01",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 13351,
"upload_time": "2022-12-21T22:24:43",
"upload_time_iso_8601": "2022-12-21T22:24:43.062149Z",
"url": "https://files.pythonhosted.org/packages/6f/45/b24dcdc3c55fb103645bbef76e68f5ba05a8c2748def56bd917872ce12cc/flamewok-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "15a145b080f99a8e2a23b079db80d0a2",
"sha256": "0fe453c8195ce38dcf6f4bbc412bfa06dcf497476c1f6835a2344ac8fbe529f1"
},
"downloads": -1,
"filename": "flamewok-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "15a145b080f99a8e2a23b079db80d0a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12338,
"upload_time": "2022-12-21T22:24:44",
"upload_time_iso_8601": "2022-12-21T22:24:44.889793Z",
"url": "https://files.pythonhosted.org/packages/e6/eb/82d0cbaf2c08ab2cbb9ca6ee4a0903250f37b474d844558140985b9c1569/flamewok-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-21 22:24:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "byoso",
"github_project": "flamewok",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "flamewok"
}