flamewok


Nameflamewok JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/byoso/flamewok
SummaryPython micro framework for terminal UI applications
upload_time2022-09-04 14:39:52
maintainer
docs_urlNone
authorVincent Fabre
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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"),
    )
```

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/5d/5f/6c9b23bdd1c3b375442347b81de1c93d2e5624a094faa1dfb3c0701ee636/flamewok-1.1.0.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\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.1.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "651432fece288140f9e889042317630d",
                "sha256": "feb5288e8df03352da5447a0873dd000092ad8a9ccb615d010cda7e786073db4"
            },
            "downloads": -1,
            "filename": "flamewok-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "651432fece288140f9e889042317630d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11814,
            "upload_time": "2022-09-04T14:39:50",
            "upload_time_iso_8601": "2022-09-04T14:39:50.146438Z",
            "url": "https://files.pythonhosted.org/packages/41/1b/6f693e902de9b0417e376ec06969233546262c4cb5ba85bf56e9190fff4b/flamewok-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "a9de958d1baed02b8067d02d6ad9be95",
                "sha256": "6671c40a634a30e746d8b20c3f4c4c603706ee6fdcc5156a616e91cc145b48fc"
            },
            "downloads": -1,
            "filename": "flamewok-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a9de958d1baed02b8067d02d6ad9be95",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9489,
            "upload_time": "2022-09-04T14:39:52",
            "upload_time_iso_8601": "2022-09-04T14:39:52.184826Z",
            "url": "https://files.pythonhosted.org/packages/5d/5f/6c9b23bdd1c3b375442347b81de1c93d2e5624a094faa1dfb3c0701ee636/flamewok-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-09-04 14:39:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "byoso",
    "github_project": "flamewok",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "flamewok"
}
        
Elapsed time: 0.40653s