{"id":28388800,"url":"https://github.com/lechu445/consolemenu","last_synced_at":"2025-07-23T21:38:57.874Z","repository":{"id":42708027,"uuid":"133174972","full_name":"lechu445/ConsoleMenu","owner":"lechu445","description":"A simple, highly customizable, DOS-like console menu","archived":false,"fork":false,"pushed_at":"2024-04-14T15:12:35.000Z","size":105,"stargazers_count":49,"open_issues_count":3,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-27T07:41:23.608Z","etag":null,"topics":["console-tool","csharp","dotnet","menu"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lechu445.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-05-12T18:54:36.000Z","updated_at":"2025-05-15T20:51:43.000Z","dependencies_parsed_at":"2024-04-14T15:52:18.941Z","dependency_job_id":null,"html_url":"https://github.com/lechu445/ConsoleMenu","commit_stats":{"total_commits":39,"total_committers":4,"mean_commits":9.75,"dds":0.5641025641025641,"last_synced_commit":"c9316839ecbe33f49874fd0f5e6634238cc2226f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lechu445/ConsoleMenu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechu445%2FConsoleMenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechu445%2FConsoleMenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechu445%2FConsoleMenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechu445%2FConsoleMenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lechu445","download_url":"https://codeload.github.com/lechu445/ConsoleMenu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechu445%2FConsoleMenu/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266753970,"owners_count":23979145,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["console-tool","csharp","dotnet","menu"],"created_at":"2025-05-30T23:15:12.019Z","updated_at":"2025-07-23T21:38:57.854Z","avatar_url":"https://github.com/lechu445.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ConsoleMenu\nA simple, highly customizable, DOS-like console menu\n\n![img](https://raw.githubusercontent.com/lechu445/ConsoleMenu/master/preview.gif)\n\nNuget package: https://www.nuget.org/packages/ConsoleMenu-simple\n\n## Usage\n```csharp\n      var subMenu = new ConsoleMenu(args, level: 1)\n        .Add(\"Sub_One\", () =\u003e SomeAction(\"Sub_One\"))\n        .Add(\"Sub_Two\", () =\u003e SomeAction(\"Sub_Two\"))\n        .Add(\"Sub_Three\", () =\u003e SomeAction(\"Sub_Three\"))\n        .Add(\"Sub_Four\", () =\u003e SomeAction(\"Sub_Four\"))\n        .Add(\"Sub_Close\", ConsoleMenu.Close)\n        .Configure(config =\u003e\n        {\n          config.Selector = \"--\u003e \";\n          config.EnableFilter = true;\n          config.Title = \"Submenu\";\n          config.EnableBreadcrumb = true;\n          config.WriteBreadcrumbAction = titles =\u003e Console.WriteLine(string.Join(\" / \", titles));\n        });\n        \n      var menu = new ConsoleMenu(args, level: 0)\n        .Add(\"One\", () =\u003e SomeAction(\"One\"))\n        .Add(\"Two\", () =\u003e SomeAction(\"Two\"))\n        .Add(\"Three\", () =\u003e SomeAction(\"Three\"))\n        .Add(\"Sub\", subMenu.Show)\n        .Add(\"Change me\", (thisMenu) =\u003e thisMenu.CurrentItem.Name = \"I am changed!\")\n        .Add(\"Close\", ConsoleMenu.Close)\n        .Add(\"Action then Close\", (thisMenu) =\u003e { SomeAction(\"Close\"); thisMenu.CloseMenu(); })\n        .Add(\"Exit\", () =\u003e Environment.Exit(0))\n        .Configure(config =\u003e\n        {\n          config.Selector = \"--\u003e \";\n          config.EnableFilter = true;\n          config.Title = \"Main menu\";\n          config.EnableWriteTitle = true;\n          config.EnableBreadcrumb = true;\n        });\n\n      menu.Show();\n```\n\n### Running app from console with pre-selected menu items \nTo do this, use `public ConsoleMenu(string[] args, int level)` constructor during initialization.\nUse double quotes for item names and digits for item numbers. Here are some examples:\n```csharp\n--menu-select=0.1                      //run first at level 0 and second at level 1\n--menu-select=\"Sub.Sub_One.'Close...'\" //run \"Sub\" at level 0 and \"Sub_One\" at level 1, and \"Close...\" at level 2\n--menu-select=\"Sub.2\"                  //run item \"Sub\" at level 0, and then run third item at level 1\n```\n\n### Configuration\nYou can also define configuration via .Configure() method. The default config looks like:\n```csharp\n  public class MenuConfig\n  {\n    public ConsoleColor SelectedItemBackgroundColor = Console.ForegroundColor;\n    public ConsoleColor SelectedItemForegroundColor = Console.BackgroundColor;\n    public ConsoleColor ItemBackgroundColor = Console.BackgroundColor;\n    public ConsoleColor ItemForegroundColor = Console.ForegroundColor;\n    public Encoding InputEncoding = Console.InputEncoding;\n    public Encoding OutputEncoding = Console.OutputEncoding;\n    public Action WriteHeaderAction = () =\u003e Console.WriteLine(\"Pick an option:\");\n    public Action\u003cMenuItem\u003e WriteItemAction = item =\u003e Console.Write(\"[{0}] {1}\", item.Index, item.Name);\n    public string Selector = \"\u003e\u003e \";\n    public string FilterPrompt = \"Filter: \";\n    public bool ClearConsole = true;\n    public bool EnableFilter = false;\n    public string ArgsPreselectedItemsKey = \"--menu-select=\";\n    public char ArgsPreselectedItemsValueSeparator = '.';\n    public bool EnableWriteTitle = false;\n    public string Title = \"My menu\";\n    public Action\u003cstring\u003e WriteTitleAction = title =\u003e Console.WriteLine(title);\n    public bool EnableBreadcrumb = false;\n    public Action\u003cIReadOnlyList\u003cstring\u003e\u003e WriteBreadcrumbAction = titles =\u003e Console.WriteLine(string.Join(\" \u003e \", titles));\n    public bool EnableAlphabet = false;\n  }\n```\nExample:\n```csharp\n      new ConsoleMenu()\n        .Add(\"One\", () =\u003e SomeAction(\"One\"))\n        .Add(\"Two\", () =\u003e SomeAction(\"Two\"))\n        .Add(\"Close\", ConsoleMenu.Close)\n        .Configure(config =\u003e { config.Selector = \"--\u003e \"; })\n        .Show();\n```\n## Requirements\nFramework compatible with .NET Standard 1.3 (.NET Core 1.0, .NET Framework 4.6, Mono 4.6) or higher.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flechu445%2Fconsolemenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flechu445%2Fconsolemenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flechu445%2Fconsolemenu/lists"}