Skip to content

πŸ‘¨πŸ½β€πŸ³ CookLang parser for .NET

License

Notifications You must be signed in to change notification settings

heytherewill/CookLangNet

Repository files navigation

πŸ‘¨πŸ½β€πŸ³ CookLang parser for .NET

CookLangNet is simple and ergonomic parser for the CookLang spec written in F# for the .NET ecosystem.

Installation

dotnet add package CookLangNet

The main package relies heavily on F# types. If you are using C# and want a friendlier API, use the CookLang.CSharp package instead:

dotnet add package CookLangNet.CSharp

Usage

Currently there's only one public API method, so using this library is as simple as:

open CookLangNet
open System.IO

let recipe = 
    File.ReadAllText("path/to/file")
    |> CookLangNet.CookLangParser.parse

Alternatively, if using the CookLang.CSharp package:

using CookLangNet.CSharp;
using System.IO;

var recipeRawText = File.ReadAllText("path/to/file");
var recipe = CookLangParser.Parse(recipeRawText);

Contributing

This project has CI health checks that run whenever you PR against the main branch. In order to ensure your contributions will behave correctly on CI, run the tests and the linter locally. Start by installing the linter tool, if you haven't:

dotnet tool install -g fantomas

Then to run the tests and the linter:

dotnet test
fantomas ./CookLangNet/ ./CookLangNet.CSharp/ ./CookLangNet.Tests/

Credits

Cook by Jino from the Noun Project