Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(text): prompt colour #1089

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/commands/compute/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func (c *InitCommand) Exec(in io.Reader, out io.Writer) (err error) {
return err
}
if !cont {
text.Break(out)
return fsterr.RemediationError{
Inner: fmt.Errorf("project directory not empty"),
Remediation: fsterr.ExistingDirRemediation,
Expand Down
12 changes: 9 additions & 3 deletions pkg/text/color.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package text

import "github.com/fatih/color"
import (
"github.com/fatih/color"
)

// Bold is a Sprint-class function that makes the arguments bold.
var Bold = color.New(color.Bold).SprintFunc()
Expand All @@ -20,8 +22,12 @@ var BoldGreen = color.New(color.Bold, color.FgGreen).SprintFunc()
// Reset is a Sprint-class function that resets the color for the arguments.
var Reset = color.New(color.Reset).SprintFunc()

// Prompt is a Sprint-class function that makes the arguments bold and grey.
var Prompt = color.New(color.Bold, color.FgHiBlack).SprintFunc()
// Prompt is a Sprint-class function that makes the arguments bold and uses the
// default colour for the terminal.
//
// IMPORTANT: Be careful modifying with Black or White as this can break themes.
// e.g. Black with Solarized Dark makes the text invisible!
var Prompt = color.New(color.Bold).SprintFunc()

// ColorFn is a function returned from a color.SprintFunc() call.
type ColorFn func(a ...any) string
Loading