{"id":22816708,"url":"https://github.com/nicolaiw/fsmenu","last_synced_at":"2025-06-10T11:01:49.028Z","repository":{"id":149175709,"uuid":"97860408","full_name":"nicolaiw/FsMenu","owner":"nicolaiw","description":"A very small DSL to create an interactive cli.","archived":false,"fork":false,"pushed_at":"2018-03-05T08:34:14.000Z","size":5046,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-03T14:26:29.333Z","etag":null,"topics":["cli","console","dsl","fsharp"],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicolaiw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-07-20T17:15:17.000Z","updated_at":"2021-03-05T23:50:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec27921e-c9e1-403a-981c-8ed067b02a99","html_url":"https://github.com/nicolaiw/FsMenu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolaiw%2FFsMenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolaiw%2FFsMenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolaiw%2FFsMenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolaiw%2FFsMenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolaiw","download_url":"https://codeload.github.com/nicolaiw/FsMenu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolaiw%2FFsMenu/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258963931,"owners_count":22784892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","console","dsl","fsharp"],"created_at":"2024-12-12T14:08:58.640Z","updated_at":"2025-06-10T11:01:49.014Z","avatar_url":"https://github.com/nicolaiw.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FsMenu\n\n\u003e A very small DSL to create an interactive cli.\n\n### Build status\n\n**Master Branch**\n\n[![Build status](https://ci.appveyor.com/api/projects/status/tngsbj4u54o90fit/branch/master?svg=true)](https://ci.appveyor.com/project/Jallah/fsmenu/branch/master)\n\n### Nuget\n\nInc.\n\n### Usage\n\n#### The DSL:\n\n```fsharp\n// Creates a new menu\nlet Menu = Sub\n\n// Render sub menu\nlet (+\u003e) name entry : (string * MenuEntry) = (name,entry)\n\n// Execute action and exit\nlet (=\u003e) s f = (s, Action (fun () -\u003e f(); Exit))\n\n// Execute action and render the previous menu\nlet (\u003c+) s f = (s, Action (fun () -\u003e f(); NavigateBack))\n\n// Execute action and render the menu where you come frome\nlet (\u003c+=) s f = (s, Action (fun () -\u003e f(); Stay))\n```\n\n#### Example:\n\n```fsharp\n\nlet testFunc() = \n    printfn \"selected Sub Sub 3\"\n    printf \"handle some input: \"\n    let input = Console.ReadLine()\n    // Do some stuff with input\n    ()\n\nprintfn \"Use Keys: UP-Arrow DOWN-Arrow ENTER BACK-SPACE\\n\"\n\nlet mutable yesOrNo = \"\"\n\nlet test =\n    Menu [\n        \"Item 1\" =\u003e (fun () -\u003e printf \"selected Item 1\")\n        \"Item 2\" +\u003e\n           Menu [ \n               \"Sub 1\" +\u003e\n                       Menu [\n                           \"Sub Sub 1\" =\u003e (fun () -\u003e printf \"selected Sub Sub 1\")\n                           \"Sub Sub 2\" +\u003e\n                                        Menu [\n                                                \"yes\" \u003c+ (fun () -\u003e yesOrNo \u003c- \"--yes\")\n                                                \"no \" \u003c+ (fun () -\u003e yesOrNo \u003c- \"--no\") ]\n                           \"Sub Sub 3\" \u003c+ testFunc]\n               \"Sub 2\" =\u003e (fun () -\u003e printf \"selected Sub 2\")\n               \"Sub 3\" =\u003e (fun () -\u003e printf \"exec some command with param %s\" yesOrNo)]] \n               \n\nrender test \"\u003c--\"\n```\n\n\u003e Instead of `(fun () -\u003e printf ...` you could pass any `unit -\u003e unit` function.\n\n\n#### Will turn into\n\n![](https://github.com/nicolaiw/FsMenu/blob/master/misc/sample.gif)\n\n#### Want some color ? :)\n\n```fsharp\nrenderWithColoredEmphaziser test \"\u003c--\" Color.Green\n```\n\n#### Here it is\n\n![](https://github.com/nicolaiw/FsMenu/blob/master/misc/sample3.gif)\n\n### It is also possible to emphazise the entry\n\n```fsharp\nrenderWithColoredEntry test Color.Cyan\n```\n\n![](https://github.com/nicolaiw/FsMenu/blob/master/misc/sample4.gif)\n\n### Or Both, the emphaziser and the entry\n\n```fsharp\nrenderWithColoredLine test \"\u003c--\" Color.Green\n```\n\n![](https://github.com/nicolaiw/FsMenu/blob/master/misc/sample5.gif)\n\n#### Another example\n\n[Here](https://github.com/nicolaiw/FsMenu/tree/master/misc)\n\n### Build\n\n+ On Windows run build.cmd\n+ On Linux run build.sh\n\n### TODO ( contributes are very welcome :D )\n+ Add support for multiselect list and single select list\n+ Create NuGet Package using Paket\n+ Clean build.fsx\n+ Refactoring: The goal is too use the render funcion like `render test \u003c| withColoredEmphaziser \"\u003c--\" Color.Green` or something like that\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolaiw%2Ffsmenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolaiw%2Ffsmenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolaiw%2Ffsmenu/lists"}