-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: better err handling, print fmt
- Loading branch information
Showing
5 changed files
with
106 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package helper | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/charmbracelet/lipgloss" | ||
) | ||
|
||
const maxWidth = 80 | ||
|
||
const ( | ||
PrintModeInfo = 0 | ||
PrintModeSuccess = 1 | ||
PrintModeErr = 2 | ||
) | ||
|
||
func Print(str string, printMode int) { | ||
var PaddingLeft = lipgloss.NewStyle().PaddingLeft(2).MaxWidth(maxWidth) | ||
switch printMode { | ||
case PrintModeInfo: | ||
fmt.Println(PaddingLeft.Foreground(lipgloss.Color("11")).Render(str)) | ||
case PrintModeSuccess: | ||
fmt.Println(PaddingLeft.Foreground(lipgloss.Color("14")).Render(str)) | ||
case PrintModeErr: | ||
fmt.Println(PaddingLeft.Foreground(lipgloss.Color("202")).Render(str)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters