From 52d80223ed090fff461ae787a1ae166ba899cf66 Mon Sep 17 00:00:00 2001 From: zoryamba Date: Sat, 4 Oct 2025 20:03:57 +0300 Subject: [PATCH] add divider and colored outputs --- en/digging-deeper/artisan-console.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/en/digging-deeper/artisan-console.md b/en/digging-deeper/artisan-console.md index f849676e..23b1ccf7 100644 --- a/en/digging-deeper/artisan-console.md +++ b/en/digging-deeper/artisan-console.md @@ -369,6 +369,19 @@ func (receiver *SendEmails) Handle(ctx console.Context) error { } ``` +There are few helpers to write to console with respective color: + +```go +ctx.Green("This is a green message") +ctx.Greenln("This is a green line message") +ctx.Red("This is a red message") +ctx.Redln("This is a red line message") +ctx.Yellow("This is a yellow message") +ctx.Yellowln("This is a yellow line message") +ctx.Black("This is a black message") +ctx.Blackln("This is a black line message") +``` + You can use the `NewLine` method to write a new line to the console: ```go @@ -424,6 +437,15 @@ err := ctx.Spinner("Loading...", console.SpinnerOption{ }) ``` +### Divider + +To show terminal-width divider you may use `Divider` method. + +```go +ctx.Divider() // ---------- +ctx.Divider("=>") // =>=>=>=>=> +``` + ## Category You can set a set of commands to the same category, convenient in `go run . artisan list`: