Skip to content

Navigation Menu

Sign in
Sign up

Repository files navigation

cowsay (.NET)

 __________________
< srsly dude, why? >
 ------------------
 \ ^__^
 \ (oo)\_______
 (__)\ )\/\
 ||----w |
 || ||

.NET Build Coverage Status

cowsay is a configurable talking cow, originally written in Perl by Tony Monroe

This project is a translation in C#/.NET of the original program, this has been written as a library rather than a standalone executable so it can easily be integrated into your own projects - for example a startup splashscreen for a CLI app.

 _________________________________
/ Environment Production \
| Service Order |
\ Node lin-1234562 /
 ---------------------------------
 \ ^__^
 \ (++)\_______
 (__)\ )\/\
 ||----w |
 || ||

The .cow files were manually copied from https://github.com/piuccio/cowsay.

Install

With .NET DI

dotnet add package Cowsay
dotnet add package Cowsay.Extensions.DependencyInjection

Without .NET DI

dotnet add package Cowsay

Usage

With .NET DI

services.AddCowsay();
public class MyClass
{
 private ICattleFarmer _cattleFarmer;
 public MyClass(ICattleFarmer cattleFarmer)
 {
 _cattleFarmer = cattleFarmer;
 }
 public async Task DoThing()
 {
 var myCow = await cattleFarmer.RearCowAsync("default");
 Console.WriteLine(myCow.Say("I was reared on dependency injection.");
 }
}

Output

 _______________________________________
< I was reared on dependency injection. >
 ---------------------------------------
 \ ^__^
 \ (oo)\_______
 (__)\ )\/\
 ||----w |
 || ||

Without .NET DI

var staticCow = await DefaultCattleFarmer.RearCowWithDefaults("default");
Console.WriteLine(staticCow.Say("I'm a static cow, no DI needed.", cowEyes: "xx"));

Output

 _________________________________
< I'm a static cow, no DI needed. >
 ---------------------------------
 \ ^__^
 \ (xx)\_______
 (__)\ )\/\
 ||----w |
 || ||

About

.NET adaptation of the JavaScript version of Cowsay

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /