Skip to content

Commit

Permalink
feat: use the number of CPUs in the machine as the default worker count
Browse files Browse the repository at this point in the history
  • Loading branch information
a-h committed Apr 25, 2023
1 parent e24f4ff commit da42500
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/templ/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"os"
"runtime"
"runtime/debug"

"github.com/a-h/templ"
Expand Down Expand Up @@ -76,7 +77,7 @@ func generateCmd(args []string) {
fileName := cmd.String("f", "", "Optionally generates code for a single file, e.g. -f header.templ")
path := cmd.String("path", ".", "Generates code for all files in path.")
sourceMapVisualisations := cmd.Bool("sourceMapVisualisations", false, "Set to true to generate HTML files to visualise the templ code and its corresponding Go code.")
workerCount := cmd.Int("w", 4, "Number of workers to run in parallel.")
workerCount := cmd.Int("w", runtime.NumCPU(), "Number of workers to run in parallel.")
helpFlag := cmd.Bool("help", false, "Print help and exit.")
err := cmd.Parse(args)
if err != nil || *helpFlag {
Expand Down

0 comments on commit da42500

Please sign in to comment.