Add feedback on what port zs serve listening on

This commit is contained in:
James Mills 2024-10-01 23:03:25 +10:00
parent fe82501843
commit ce83f0d226
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
2 changed files with 9 additions and 3 deletions

View File

@ -259,7 +259,7 @@ var VarCmd = &cobra.Command{
Short: "Display variables for the specified file",
Long: `The var command extracts and display sll teh variables defined in a file.
If the name of variables (optional) are passed as additional arguments, only those variables
are display instead of all variables (the default behavior).`,
are display instead of all variables (the default behaviors).`,
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
s := ""
@ -589,9 +589,8 @@ func build(path string, w io.Writer, vars Vars) error {
return buildMarkdown(path, w, vars)
} else if ext == ".html" || ext == ".xml" {
return buildHTML(path, w, vars)
} else {
return buildRaw(path, w)
}
return buildRaw(path, w)
}
func buildAll(ctx context.Context, watch bool) error {
@ -700,6 +699,8 @@ func serve(ctx context.Context, bind, root string) error {
return err
}
log.Infof("zs %s server listening on %s", ShortVersion(), bind)
go svr.Run(ctx)
go buildAll(ctx, true)

View File

@ -48,3 +48,8 @@ func FullVersion() string {
return sb.String()
}
// ShortVersion display the short version and build
func ShortVersion() string {
return fmt.Sprintf("%s@%s", Version, Commit)
}