mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
36 lines
954 B
C#
36 lines
954 B
C#
using System;
|
|
using CliFx.Demo.Domain;
|
|
using CliFx.Infrastructure;
|
|
|
|
namespace CliFx.Demo.Utils;
|
|
|
|
internal static class ConsoleExtensions
|
|
{
|
|
public static void WriteBook(this ConsoleWriter writer, Book book)
|
|
{
|
|
// Title
|
|
using (writer.Console.WithForegroundColor(ConsoleColor.White))
|
|
writer.WriteLine(book.Title);
|
|
|
|
// Author
|
|
writer.Write(" ");
|
|
writer.Write("Author: ");
|
|
|
|
using (writer.Console.WithForegroundColor(ConsoleColor.White))
|
|
writer.WriteLine(book.Author);
|
|
|
|
// Published
|
|
writer.Write(" ");
|
|
writer.Write("Published: ");
|
|
|
|
using (writer.Console.WithForegroundColor(ConsoleColor.White))
|
|
writer.WriteLine($"{book.Published:d}");
|
|
|
|
// ISBN
|
|
writer.Write(" ");
|
|
writer.Write("ISBN: ");
|
|
|
|
using (writer.Console.WithForegroundColor(ConsoleColor.White))
|
|
writer.WriteLine(book.Isbn);
|
|
}
|
|
} |