2 Commits

Author SHA1 Message Date
4eaead6abc hint for running project 2025-12-31 12:16:59 -05:00
4abf2969ca new hint ui function 2025-12-31 12:16:51 -05:00
2 changed files with 25 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package new
import ( import (
"fes/modules/config" "fes/modules/config"
"fes/modules/ui"
"fmt" "fmt"
"os" "os"
"os/exec" "os/exec"
@@ -114,5 +115,15 @@ All commands are run from the root of the project, from a terminal:
## What to learn more? ## What to learn more?
Check out [Fes's docs](https://docs.vxserver.dev/static/fes.html).`, "$$", "`"), dir, dir) Check out [Fes's docs](https://docs.vxserver.dev/static/fes.html).`, "$$", "`"), dir, dir)
ui.Hint("you can run this with `fes run %s`", dir)
fmt.Println("Created new Fes project at", func() string {
if res, err := filepath.Abs(dir); err == nil {
return res
}
return dir
}())
return nil return nil
} }

View File

@@ -11,6 +11,10 @@ import (
"github.com/fatih/color" "github.com/fatih/color"
) )
const (
hint_color = 0xbda02a
)
/* print out the current path (route) and relevant error */ /* print out the current path (route) and relevant error */
func Path(path string, err error) { func Path(path string, err error) {
path = strings.TrimPrefix(path, "/") path = strings.TrimPrefix(path, "/")
@@ -48,6 +52,16 @@ func Fatal(msg string, err error) error {
panic(err) panic(err)
} }
/* print a useful hint to the user */
func Hint(format string, args ...any) {
color.RGB(func(hex int) (r, g, b int) {
r = (hex >> 16) & 0xFF
g = (hex >> 8) & 0xFF
b = hex & 0xFF
return
}(hint_color)).Printf("hint: %s\n", fmt.Sprintf(format, args...))
}
/* print message using the ok status color */ /* print message using the ok status color */
func OK(msg string) { func OK(msg string) {
color.Green(msg) color.Green(msg)