Home

Awesome

Typin

<p align="center">

Build Coverage Version Downloads of Typin Downloads of Typin.Core

</p>

See TypinExamples website for interective examples.

<table> <tr> <td> <p align="center"> <img src="https://raw.githubusercontent.com/adambajguz/Typin/master/.img/typin-logo-256px.png" width="75%"> </p> </td> <td>

<b>Table of contents</b>

</tr> </table>

Typin is a simple to use, ASP.NET Core inspired framework for building both interactive command line applications and command line tools (direct mode). However, it is not limited to direct and interactive modes, because you can create your own modes.

Etymology: Typin is made out of "Typ" for "Type" and "in" for "interactively". It's pronounced as "Ty pin".

Typin is not just a parser but a complete application framework. Its main goal is to provide an enjoyable, similar to ASP.NET Core, development experience when building command line applications. Its primary goal is to completely take over the user input layer, letting you forget about the infrastructure and instead focus on writing your application.

Typin roots in CliFx

Typin is build based on the source code of CliFx, but it wants to be a ASP.NET Core for CLI like Cocona but faster. It has many additional features compared to CliFx:

Overall, Typin is a framework that is much more flexible and rich with both features and metadata about defined commands etc.

See CHANGELOG.md for a complete list of changes.

Also see WIKI: Roadmap and support for more info about future and support.

Features

Installing Typin

You should install Typin with NuGet:

Install-Package Typin

Or via the .NET Core command line interface:

dotnet add package Typin

Both commands will download and install Typin with all required dependencies.

Typin.Core

If you need only API interfaces, you can install TypinCore with NuGet.

Install-Package Typin.Core

Or via the .NET Core command line interface:

dotnet add package Typin.Core

Both commands will download and install Typin.Core with all required dependencies.

Getting started and Documentation

public static class Program
{
    public static async Task<int> Main() =>
        await new CliApplicationBuilder()
            .AddCommandsFromThisAssembly()
            .Build()
            .RunAsync();
}

[Command]
public class HelloWorldCommand : ICommand
{
    public async ValueTask ExecuteAsync(IConsole console)
    {
        await console.Output.WriteLineAsync("Hello world!");
    }
}

See wiki for detailed instructions and documentation.

Screenshots

help screen

Benchmarks

Here's how Typin's execution overhead compares to that of other libraries (single command comparison) and with increasing number of commands.

Typin 3.1

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19044.1415 (21H2)
Intel Core i7-4790 CPU 3.60GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.101
  [Host]     : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
  DefaultJob : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
MethodMeanErrorStdDevRatioRank
CommandLineParser1.810 us0.0283 us0.0265 us0.0091
CliFx70.937 us0.8013 us0.7103 us0.3732
Clipr81.382 us1.3975 us1.3725 us0.4283
McMaster.Extensions.CommandLineUtils88.881 us1.0713 us1.0021 us0.4684
Typin190.249 us0.3856 us0.3220 us1.0005
System.CommandLine278.502 us5.5451 us5.9332 us1.4626
PowerArgs300.629 us1.3090 us1.1604 us1.5797
Cocona1,283.562 us88.6368 us244.1316 us6.4928
MethodMeanErrorStdDevRatioRank
'CliFx - 1 command'68.67 us0.207 us0.173 us0.361
'CliFx - 2 commands'77.32 us0.577 us0.512 us0.402
'CliFx - 5 commands'98.64 us0.260 us0.230 us0.513
'CliFx - 10 commands'135.11 us0.317 us0.297 us0.704
'Typin - 1 command'192.11 us0.662 us0.553 us1.005
'Typin - 2 commands'202.54 us0.851 us0.754 us1.056
'CliFx - 20 commands'231.62 us0.502 us0.445 us1.217
'Typin - 5 commands'237.19 us0.388 us0.363 us1.238
'Typin - 10 commands'298.32 us2.848 us2.378 us1.559
'Typin - 20 commands'440.23 us0.773 us0.646 us2.2910

Typin <= 2.1.1

BenchmarkDotNet=v0.12.0, OS=Windows 10.0.19041
Intel Core i7-4790 CPU 3.60GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=3.1.402
  [Host]     : .NET Core 3.1.8 (CoreCLR 4.700.20.41105, CoreFX 4.700.20.41903), X64 RyuJIT
  DefaultJob : .NET Core 3.1.8 (CoreCLR 4.700.20.41105, CoreFX 4.700.20.41903), X64 RyuJIT
MethodMeanErrorStdDevRatioRank
CommandLineParser2.489 us0.0481 us0.0573 us0.031
CliFx51.513 us0.3411 us0.3024 us0.572
Typin90.748 us0.4652 us0.4351 us1.003
McMaster.Extensions.CommandLineUtils129.112 us1.5520 us1.3758 us1.424
Clipr131.652 us2.8059 us4.1129 us1.474
System.CommandLine198.114 us3.7021 us3.4630 us2.185
PowerArgs257.859 us1.4766 us1.3812 us2.846
Cocona1166 us7.3347 us6.1248 us12.867
MethodMeanErrorStdDevRatioRank
'CliFx - 1 command'51.15 us0.843 us0.788 us0.541
'CliFx - 2 commands'71.39 us1.375 us1.972 us0.762
'Typin - 1 command'94.46 us1.974 us2.027 us1.003
'Typin - 2 commands'118.90 us2.668 us4.811 us1.294
'CliFx - 5 commands'126.71 us1.908 us1.692 us1.345
'Typin - 5 commands'180.16 us3.459 us3.701 us1.916
'CliFx - 10 commands'222.28 us3.079 us2.880 us2.357
'Typin - 10 commands'281.79 us4.679 us4.148 us2.998
'CliFx - 20 commands'454.07 us8.708 us8.942 us4.819
'Typin - 20 commands'519.70 us6.735 us6.300 us5.5010

Legends: