{"id":18824323,"url":"https://github.com/galassie/fs-spectre","last_synced_at":"2025-10-20T11:25:08.440Z","repository":{"id":65548045,"uuid":"593565594","full_name":"galassie/fs-spectre","owner":"galassie","description":"👻💻 Spectre.Console with F# style.","archived":false,"fork":false,"pushed_at":"2024-09-04T20:09:01.000Z","size":207,"stargazers_count":81,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-16T07:31:45.867Z","etag":null,"topics":["cli","console-application","dotnet","fsharp","fsharp-console"],"latest_commit_sha":null,"homepage":"","language":"F#","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/galassie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-01-26T10:26:53.000Z","updated_at":"2025-07-26T19:03:07.000Z","dependencies_parsed_at":"2024-12-25T00:17:28.475Z","dependency_job_id":null,"html_url":"https://github.com/galassie/fs-spectre","commit_stats":{"total_commits":52,"total_committers":1,"mean_commits":52.0,"dds":0.0,"last_synced_commit":"330645200da5a8d4488b91b729f19f857856d581"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/galassie/fs-spectre","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galassie%2Ffs-spectre","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galassie%2Ffs-spectre/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galassie%2Ffs-spectre/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galassie%2Ffs-spectre/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/galassie","download_url":"https://codeload.github.com/galassie/fs-spectre/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galassie%2Ffs-spectre/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271739901,"owners_count":24812636,"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-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["cli","console-application","dotnet","fsharp","fsharp-console"],"created_at":"2024-11-08T00:56:10.113Z","updated_at":"2025-10-20T11:25:03.412Z","avatar_url":"https://github.com/galassie.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FsSpectre\n\n[![Build status](https://ci.appveyor.com/api/projects/status/4nb6f3882i39um3v?svg=true)](https://ci.appveyor.com/project/galassie/fs-spectre)\n\n[Spectre.Console](https://spectreconsole.net/) with F# style.\n\nFsSpectre is a small library that extends Spectre.Console and allow to write beautiful console applications in a declarative and more F#-friendly way.\nIt leverages [Computation Expressions](https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/computation-expressions) to create the widgets in a declarative style.\n\n## Add package\n\nIf you want to add this package to your project, execute the following command:\n\n``` shell\ndotnet add package FsSpectre\n```\n\n## Build on your machine\n\nIf you want to build this library on your machine, execute the following commands:\n\n``` shell\ngit clone git@github.com:galassie/fs-spectre.git\ncd fs-spectre\ndotnet build\n```\n\n## Examples\n\n### Table\n\nWith C# + Spectre.Console:\n```csharp\nvar table = new Table();\ntable.AddColumn(\"Foo\");\ntable.AddColumn(new TableColumn(\"Bar\").Centered());\ntable.AddRow(\"Baz\", \"[green]Qux[/]\");\ntable.AddRow(new Markup(\"[blue]Corgi[/]\"), new Panel(\"Waldo\"));\nAnsiConsole.Write(table);\n```\n\nWith F# + FsSpectre:\n```fsharp\ntable {\n    column_text \"\"\n    column (tableColumn { header_text \"Feature\"; centerd })\n    row_text [| \"Baz\"; \"[green]Qux[/]\" |]\n    row [| markup { text \"[blue]Corgi[/]\" }; panel { content_text \"Waldo\" } |]\n} |\u003e AnsiConsole.Write\n```\n\n### Bar Chart\n\nWith C# + Spectre.Console:\n```csharp\nAnsiConsole.Write(new BarChart()\n    .Width(60)\n    .Label(\"[green bold underline]Number of fruits[/]\")\n    .CenterLabel()\n    .AddItem(\"Apple\", 12, Color.Yellow)\n    .AddItem(\"Orange\", 54, Color.Green)\n    .AddItem(\"Banana\", 33, Color.Red));\n```\n\nWith F# + FsSpectre:\n```fsharp\nbarChart {\n    width 60\n    label \"[green bold underline]Number of fruits[/]\"\n    centered_label\n    item (\"Apple\", 12, Color.Yellow)\n    item (\"Oranges\", 54, Color.Green)\n    item (\"Bananas\", 33, Color.Red)\n} |\u003e AnsiConsole.Write\n```\n\n### Live Display\n\nWith C# + Spectre.Console:\n```csharp\nvar table = new Table().Centered();\n\nAnsiConsole.Live(table)\n    .Start(ctx =\u003e \n    {\n        table.AddColumn(\"Foo\");\n        ctx.Refresh();\n        Thread.Sleep(1000);\n\n        table.AddColumn(\"Bar\");\n        ctx.Refresh();\n        Thread.Sleep(1000);\n    });\n```\n\nWith F# + FsSpectre:\n```fsharp\nlet liveDisplayTable = table { centered }\n\nliveDisplay {\n    target liveDisplayTable\n\n    start (fun ctx -\u003e\n        liveDisplayTable.AddColumn(\"Foo\") |\u003e ignore\n        ctx.Refresh()\n        Thread.Sleep(1000)\n\n        liveDisplayTable.AddColumn(\"Bar\") |\u003e ignore\n        ctx.Refresh()\n        Thread.Sleep(1000))\n}\n```\n\nand for the Async version:\n```fsharp\nlet liveDisplayAsyncTable = table { title_text \"Async Table\" }\n\nliveDisplayAsync {\n    target liveDisplayAsyncTable\n\n    start (fun ctx -\u003e task {\n        liveDisplayAsyncTable.AddColumn(\"Foo\") |\u003e ignore\n        ctx.Refresh()\n        do! Task.Delay(1000)\n\n        liveDisplayAsyncTable.AddColumn(\"Bar\") |\u003e ignore\n        ctx.Refresh()\n        do! Task.Delay(1000)\n    })\n}\n```\n\n### Progress\n\nWith C# + Spectre.Console:\n```csharp\nAnsiConsole.Progress()\n    .Start(ctx =\u003e \n    {\n        var task1 = ctx.AddTask(\"[green]Reticulating splines[/]\");\n        var task2 = ctx.AddTask(\"[green]Folding space[/]\");\n\n        while(!ctx.IsFinished) \n        {\n            Thread.Sleep(250);\n            task1.Increment(1.5);\n            task2.Increment(0.5);\n        }\n    });\n```\n\nWith F# + FsSpectre:\n```fsharp\nprogress {\n    start (fun ctx -\u003e\n        let task1 = ctx.AddTask(\"[green]Reticulating splines[/]\")\n        let task2 = ctx.AddTask(\"[green]Folding space[/]\")\n\n        while not ctx.IsFinished do\n            Thread.Sleep(250)\n            task1.Increment(1.5)\n            task2.Increment(0.5))\n}\n```\n\nand for the Async version:\n```fsharp\nprogressAsync {\n    start (fun ctx -\u003e task{\n        let task1 = ctx.AddTask(\"[green]Reticulating splines[/]\")\n        let task2 = ctx.AddTask(\"[green]Folding space[/]\")\n\n        while not ctx.IsFinished do\n            do! Task.Delay(250)\n            task1.Increment(1.5)\n            task2.Increment(0.5)\n    })\n}\n```\n\n### Status\n\nWith C# + Spectre.Console:\n```csharp\nAnsiConsole.Status()\n    .Spinner(Spinner.Known.Arrow)\n    .SpinnerStyle(Style.Parse(\"blue\"))\n    .Start(\"Thinking...\", ctx =\u003e \n    {\n        AnsiConsole.MarkupLine(\"Doing some work...\");\n        Thread.Sleep(1000);\n\n        ctx.Status(\"Thinking some more\");\n        ctx.Spinner(Spinner.Known.Star);\n        ctx.SpinnerStyle(Style.Parse(\"green\"));\n\n        AnsiConsole.MarkupLine(\"Doing some more work...\");\n        Thread.Sleep(2000);\n    });\n```\n\nWith F# + FsSpectre:\n```fsharp\nstatus {\n    spinner Spinner.Known.Arrow\n    spinner_style (Style.Parse(\"blue\"))\n\n    status \"Thinking...\"\n    start (fun ctx -\u003e\n        AnsiConsole.MarkupLine(\"Doing some work...\")\n        Thread.Sleep(1000)\n\n        ctx.Status \u003c- \"Thinking some more\"\n        ctx.Spinner \u003c- Spinner.Known.Star\n        ctx.SpinnerStyle \u003c- Style.Parse(\"green\")\n\n        AnsiConsole.MarkupLine(\"Doing some more work...\")\n        Thread.Sleep(2000))\n}\n```\n\nand for the Async version:\n```fsharp\nstatusAsync {\n    spinner Spinner.Known.Arrow\n    spinner_style (Style.Parse(\"blue\"))\n\n    status \"Thinking...\"\n    start (fun ctx -\u003e task {\n        AnsiConsole.MarkupLine(\"Doing some work...\")\n        do! Task.Delay(1000)\n\n        ctx.Status \u003c- \"Thinking some more\"\n        ctx.Spinner \u003c- Spinner.Known.Star\n        ctx.SpinnerStyle \u003c- Style.Parse(\"green\")\n\n        AnsiConsole.MarkupLine(\"Doing some more work...\")\n        do! Task.Delay(2000)\n    })\n}\n```\n\n## Showcase\n\nTo see an example, execute the `Showcase.fsx` with the following command (you need to build the library first):\n\n``` shell\ndotnet fsi Showcase.fsx\n```\n\n![Showcase](https://raw.githubusercontent.com/galassie/fs-spectre/main/assets/Showcase.png)\n\n## Alternatives\n\nIf you don't like this style of using Spectre.Console with Computation Expressions, check out these amazing projects: \n- [SpectreCoff](https://github.com/EluciusFTW/SpectreCoff)\n\n## Contributing\n\nCode contributions are more than welcome! 😻\n\nPlease commit any pull requests against the `main` branch.  \nIf you find any issue, please [report it](https://github.com/galassie/fs-spectre/issues)!\n\n## License\n\nThis project is licensed under [The MIT License (MIT)](https://raw.githubusercontent.com/galassie/fs-spectre/master/LICENSE.md).\n\nAuthor: [Enrico Galassi](https://twitter.com/enricogalassi88)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalassie%2Ffs-spectre","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgalassie%2Ffs-spectre","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalassie%2Ffs-spectre/lists"}