From 0cf78a8432200af0cebedce7c58a106a1cc70cd7 Mon Sep 17 00:00:00 2001 From: Adrian Hesketh Date: Mon, 8 Jul 2024 10:19:45 +0100 Subject: [PATCH 1/5] feat: add diagnose command to assist troubleshooting --- .github/ISSUE_TEMPLATE/bug_report.md | 3 + .version | 2 +- cmd/templ/diagnosecmd/main.go | 129 ++++++++++++++++++ cmd/templ/lspcmd/pls/main.go | 6 +- cmd/templ/main.go | 52 +++++++ cmd/templ/main_test.go | 6 + docs/docs/09-commands-and-tools/01-cli.md | 20 +-- .../09-commands-and-tools/02-ide-support.md | 4 + 8 files changed, 210 insertions(+), 12 deletions(-) create mode 100644 cmd/templ/diagnosecmd/main.go diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 423d3919a..9b40208ac 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -25,6 +25,9 @@ If applicable, add screenshots or screen captures to help explain your problem. **Logs** If the issue is related to IDE support, run through the LSP troubleshooting section at https://templ.guide/commands-and-tools/ide-support/#troubleshooting-1 and include logs from templ +**`templ diagnose` output** +Run `templ diagnose` and include the output. + **Desktop (please complete the following information):** - OS: [e.g. MacOS, Linux, Windows, WSL] - templ CLI version (`templ version`) diff --git a/.version b/.version index baee64fae..df0fc5a41 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.2.747 \ No newline at end of file +0.2.749 \ No newline at end of file diff --git a/cmd/templ/diagnosecmd/main.go b/cmd/templ/diagnosecmd/main.go new file mode 100644 index 000000000..84a840cd1 --- /dev/null +++ b/cmd/templ/diagnosecmd/main.go @@ -0,0 +1,129 @@ +package diagnosecmd + +import ( + "context" + "errors" + "fmt" + "log/slog" + "os" + "os/exec" + "runtime" + "strings" + + "github.com/a-h/templ" + "github.com/a-h/templ/cmd/templ/lspcmd/pls" +) + +type Arguments struct { +} + +type diagnostic struct { + Location string + Version string + OK bool + Message string +} + +func diagnoseGo() (d diagnostic) { + // Find Go. + var err error + d.Location, err = exec.LookPath("go") + if err != nil { + d.Message = fmt.Sprintf("failed to find go: %v", err) + return + } + // Run go to find the version. + cmd := exec.Command(d.Location, "version") + v, err := cmd.Output() + if err != nil { + d.Message = fmt.Sprintf("failed to get go version, check that Go is installed: %v", err) + return + } + d.Version = strings.TrimSpace(string(v)) + d.OK = true + return +} + +func diagnoseGopls() (d diagnostic) { + var err error + d.Location, err = pls.FindGopls() + if err != nil { + d.Message = fmt.Sprintf("failed to find gopls: %v", err) + return + } + cmd := exec.Command(d.Location, "version") + v, err := cmd.Output() + if err != nil { + d.Message = fmt.Sprintf("failed to get gopls version: %v", err) + return + } + d.Version = strings.TrimSpace(string(v)) + d.OK = true + return +} + +func diagnoseTempl() (d diagnostic) { + // Find templ. + var err error + d.Location, err = findTempl() + if err != nil { + d.Message = err.Error() + return + } + // Run templ to find the version. + cmd := exec.Command(d.Location, "version") + v, err := cmd.Output() + if err != nil { + d.Message = fmt.Sprintf("failed to get templ version: %v", err) + return + } + d.Version = strings.TrimSpace(string(v)) + if d.Version != templ.Version() { + d.Message = fmt.Sprintf("version mismatch - you're running %q at the command line, but the version in the path is %q", templ.Version(), d.Version) + return + } + d.OK = true + return +} + +func findTempl() (location string, err error) { + executableName := "templ" + if runtime.GOOS == "windows" { + executableName = "templ.exe" + } + executableName, err = exec.LookPath(executableName) + if err == nil { + // Found on the path. + return executableName, nil + } + + // Unexpected error. + if !errors.Is(err, exec.ErrNotFound) { + return "", fmt.Errorf("unexpected error looking for templ: %w", err) + } + + return "", fmt.Errorf("templ is not in the path (%q). You can install templ with `go install github.com/a-h/templ/cmd/templ@latest`", os.Getenv("PATH")) +} + +func Run(ctx context.Context, log *slog.Logger, args Arguments) (err error) { + log.Info("os", slog.String("name", runtime.GOOS), slog.String("arch", runtime.GOARCH)) + logDiagnostic(ctx, log, "go", diagnoseGo()) + logDiagnostic(ctx, log, "gopls", diagnoseGopls()) + logDiagnostic(ctx, log, "templ", diagnoseTempl()) + return nil +} + +func logDiagnostic(ctx context.Context, log *slog.Logger, name string, d diagnostic) { + level := slog.LevelInfo + if !d.OK { + level = slog.LevelError + } + args := []any{ + slog.String("location", d.Location), + slog.String("version", d.Version), + } + if d.Message != "" { + args = append(args, slog.String("message", d.Message)) + } + log.Log(ctx, level, name, args...) +} diff --git a/cmd/templ/lspcmd/pls/main.go b/cmd/templ/lspcmd/pls/main.go index 6792ea9ce..3986e76e3 100644 --- a/cmd/templ/lspcmd/pls/main.go +++ b/cmd/templ/lspcmd/pls/main.go @@ -31,13 +31,13 @@ func (opts Options) AsArguments() []string { return args } -func findGopls() (location string, err error) { +func FindGopls() (location string, err error) { executableName := "gopls" if runtime.GOOS == "windows" { executableName = "gopls.exe" } - _, err = exec.LookPath(executableName) + executableName, err = exec.LookPath(executableName) if err == nil { // Found on the path. return executableName, nil @@ -72,7 +72,7 @@ func findGopls() (location string, err error) { // NewGopls starts gopls and opens up a jsonrpc2 connection to it. func NewGopls(ctx context.Context, log *zap.Logger, opts Options) (rwc io.ReadWriteCloser, err error) { - location, err := findGopls() + location, err := FindGopls() if err != nil { return nil, err } diff --git a/cmd/templ/main.go b/cmd/templ/main.go index 75d5237c8..7c9d06974 100644 --- a/cmd/templ/main.go +++ b/cmd/templ/main.go @@ -11,6 +11,7 @@ import ( "runtime" "github.com/a-h/templ" + "github.com/a-h/templ/cmd/templ/diagnosecmd" "github.com/a-h/templ/cmd/templ/fmtcmd" "github.com/a-h/templ/cmd/templ/generatecmd" "github.com/a-h/templ/cmd/templ/lspcmd" @@ -35,6 +36,7 @@ commands: generate Generates Go code from templ files fmt Formats templ files lsp Starts a language server for templ files + diagnose Diagnose the templ environment version Prints the version ` @@ -44,6 +46,8 @@ func run(stdin io.Reader, stdout, stderr io.Writer, args []string) (code int) { return 64 // EX_USAGE } switch args[1] { + case "diagnose": + return diagnoseCmd(stdout, stderr, args[2:]) case "generate": return generateCmd(stdout, stderr, args[2:]) case "fmt": @@ -80,6 +84,54 @@ func newLogger(logLevel string, verbose bool, stderr io.Writer) *slog.Logger { })) } +const diagnoseUsageText = `usage: templ diagnose [...] + +Diagnoses the templ environment. + +Args: + -v + Set log verbosity level to "debug". (default "info") + -log-level + Set log verbosity level. (default "info", options: "debug", "info", "warn", "error") + -help + Print help and exit. +` + +func diagnoseCmd(stdout, stderr io.Writer, args []string) (code int) { + cmd := flag.NewFlagSet("diagnose", flag.ExitOnError) + verboseFlag := cmd.Bool("v", false, "") + logLevelFlag := cmd.String("log-level", "info", "") + helpFlag := cmd.Bool("help", false, "") + err := cmd.Parse(args) + if err != nil { + fmt.Fprint(stderr, diagnoseUsageText) + return 64 // EX_USAGE + } + if *helpFlag { + fmt.Fprint(stdout, diagnoseUsageText) + return + } + + log := newLogger(*logLevelFlag, *verboseFlag, stderr) + + ctx, cancel := context.WithCancel(context.Background()) + signalChan := make(chan os.Signal, 1) + signal.Notify(signalChan, os.Interrupt) + go func() { + <-signalChan + fmt.Fprintln(stderr, "Stopping...") + cancel() + }() + + err = diagnosecmd.Run(ctx, log, diagnosecmd.Arguments{}) + if err != nil { + color.New(color.FgRed).Fprint(stderr, "(✗) ") + fmt.Fprintln(stderr, "Command failed: "+err.Error()) + return 1 + } + return 0 +} + const generateUsageText = `usage: templ generate [...] Generates Go code from templ files. diff --git a/cmd/templ/main_test.go b/cmd/templ/main_test.go index b9fb0dc12..23c9b1d18 100644 --- a/cmd/templ/main_test.go +++ b/cmd/templ/main_test.go @@ -65,6 +65,12 @@ func TestMain(t *testing.T) { expectedStdout: lspUsageText, expectedCode: 0, }, + { + name: `"templ diagnose --help" prints usage`, + args: []string{"templ", "diagnose", "--help"}, + expectedStdout: diagnoseUsageText, + expectedCode: 0, + }, } for _, test := range tests { diff --git a/docs/docs/09-commands-and-tools/01-cli.md b/docs/docs/09-commands-and-tools/01-cli.md index a24a3f62f..113c7fe84 100644 --- a/docs/docs/09-commands-and-tools/01-cli.md +++ b/docs/docs/09-commands-and-tools/01-cli.md @@ -3,14 +3,18 @@ `templ` provides a command line interface. Most users will only need to run the `templ generate` command to generate Go code from `*.templ` files. ``` -usage: templ [parameters] -To see help text, you can run: - templ generate --help - templ fmt --help - templ lsp --help - templ version -examples: - templ generate +usage: templ [...] + +templ - build HTML UIs with Go + +See docs at https://templ.guide + +commands: + generate Generates Go code from templ files + fmt Formats templ files + lsp Starts a language server for templ files + diagnose Diagnose the templ environment + version Prints the version ``` ## Generating Go code from templ files diff --git a/docs/docs/09-commands-and-tools/02-ide-support.md b/docs/docs/09-commands-and-tools/02-ide-support.md index 27c825ac3..45f03d8a9 100644 --- a/docs/docs/09-commands-and-tools/02-ide-support.md +++ b/docs/docs/09-commands-and-tools/02-ide-support.md @@ -433,3 +433,7 @@ The logs can be quite verbose, since almost every keypress results in additional ### Look at the web server The web server option provides an insight into the internal state of the language server. It may provide insight into what's going wrong. + +### Run templ diagnose + +The `templ diagnose` command outputs information that's useful in debugging issues. From b3eb14d047a0d8b819dab46fac6707352d75a8f0 Mon Sep 17 00:00:00 2001 From: Adrian Hesketh Date: Mon, 8 Jul 2024 10:29:18 +0100 Subject: [PATCH 2/5] feat: add JSON output for IDE extensions to use --- cmd/templ/diagnosecmd/main.go | 56 ++++++++++++++++++++++++++--------- cmd/templ/main.go | 7 ++++- 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/cmd/templ/diagnosecmd/main.go b/cmd/templ/diagnosecmd/main.go index 84a840cd1..96d09574a 100644 --- a/cmd/templ/diagnosecmd/main.go +++ b/cmd/templ/diagnosecmd/main.go @@ -2,8 +2,10 @@ package diagnosecmd import ( "context" + "encoding/json" "errors" "fmt" + "io" "log/slog" "os" "os/exec" @@ -15,16 +17,27 @@ import ( ) type Arguments struct { + JSON bool `flag:"json" help:"Output the diagnostics as JSON."` } -type diagnostic struct { - Location string - Version string - OK bool - Message string +type Diagnostics struct { + OS struct { + GOOS string `json:"goos"` + GOARCH string `json:"goarch"` + } `json:"os"` + Go Diagnostic `json:"go"` + Gopls Diagnostic `json:"gopls"` + Templ Diagnostic `json:"templ"` } -func diagnoseGo() (d diagnostic) { +type Diagnostic struct { + Location string `json:"location"` + Version string `json:"version"` + OK bool `json:"ok"` + Message string `json:"message,omitempty"` +} + +func diagnoseGo() (d Diagnostic) { // Find Go. var err error d.Location, err = exec.LookPath("go") @@ -44,7 +57,7 @@ func diagnoseGo() (d diagnostic) { return } -func diagnoseGopls() (d diagnostic) { +func diagnoseGopls() (d Diagnostic) { var err error d.Location, err = pls.FindGopls() if err != nil { @@ -62,7 +75,7 @@ func diagnoseGopls() (d diagnostic) { return } -func diagnoseTempl() (d diagnostic) { +func diagnoseTempl() (d Diagnostic) { // Find templ. var err error d.Location, err = findTempl() @@ -105,15 +118,30 @@ func findTempl() (location string, err error) { return "", fmt.Errorf("templ is not in the path (%q). You can install templ with `go install github.com/a-h/templ/cmd/templ@latest`", os.Getenv("PATH")) } -func Run(ctx context.Context, log *slog.Logger, args Arguments) (err error) { - log.Info("os", slog.String("name", runtime.GOOS), slog.String("arch", runtime.GOARCH)) - logDiagnostic(ctx, log, "go", diagnoseGo()) - logDiagnostic(ctx, log, "gopls", diagnoseGopls()) - logDiagnostic(ctx, log, "templ", diagnoseTempl()) +func diagnose() (d Diagnostics) { + d.OS.GOOS = runtime.GOOS + d.OS.GOARCH = runtime.GOARCH + d.Go = diagnoseGo() + d.Gopls = diagnoseGopls() + d.Templ = diagnoseTempl() + return +} + +func Run(ctx context.Context, log *slog.Logger, stdout io.Writer, args Arguments) (err error) { + diagnostics := diagnose() + if args.JSON { + enc := json.NewEncoder(stdout) + enc.SetIndent("", " ") + return enc.Encode(diagnostics) + } + log.Info("os", slog.String("goos", diagnostics.OS.GOOS), slog.String("goarch", diagnostics.OS.GOARCH)) + logDiagnostic(ctx, log, "go", diagnostics.Go) + logDiagnostic(ctx, log, "gopls", diagnostics.Gopls) + logDiagnostic(ctx, log, "templ", diagnostics.Templ) return nil } -func logDiagnostic(ctx context.Context, log *slog.Logger, name string, d diagnostic) { +func logDiagnostic(ctx context.Context, log *slog.Logger, name string, d Diagnostic) { level := slog.LevelInfo if !d.OK { level = slog.LevelError diff --git a/cmd/templ/main.go b/cmd/templ/main.go index 7c9d06974..44d1770ad 100644 --- a/cmd/templ/main.go +++ b/cmd/templ/main.go @@ -89,6 +89,8 @@ const diagnoseUsageText = `usage: templ diagnose [...] Diagnoses the templ environment. Args: + -json + Output diagnostics in JSON format to stdout. (default false) -v Set log verbosity level to "debug". (default "info") -log-level @@ -99,6 +101,7 @@ Args: func diagnoseCmd(stdout, stderr io.Writer, args []string) (code int) { cmd := flag.NewFlagSet("diagnose", flag.ExitOnError) + jsonFlag := cmd.Bool("json", false, "") verboseFlag := cmd.Bool("v", false, "") logLevelFlag := cmd.String("log-level", "info", "") helpFlag := cmd.Bool("help", false, "") @@ -123,7 +126,9 @@ func diagnoseCmd(stdout, stderr io.Writer, args []string) (code int) { cancel() }() - err = diagnosecmd.Run(ctx, log, diagnosecmd.Arguments{}) + err = diagnosecmd.Run(ctx, log, stdout, diagnosecmd.Arguments{ + JSON: *jsonFlag, + }) if err != nil { color.New(color.FgRed).Fprint(stderr, "(✗) ") fmt.Fprintln(stderr, "Command failed: "+err.Error()) From d75cdc6fb5ef173bdaee0aaf9b48055a7d22a67a Mon Sep 17 00:00:00 2001 From: Adrian Hesketh Date: Mon, 8 Jul 2024 11:01:36 +0100 Subject: [PATCH 3/5] refactor: rename to info --- cmd/templ/{diagnosecmd => infocmd}/main.go | 52 +++++++++++----------- cmd/templ/main.go | 22 ++++----- cmd/templ/main_test.go | 6 +-- 3 files changed, 40 insertions(+), 40 deletions(-) rename cmd/templ/{diagnosecmd => infocmd}/main.go (73%) diff --git a/cmd/templ/diagnosecmd/main.go b/cmd/templ/infocmd/main.go similarity index 73% rename from cmd/templ/diagnosecmd/main.go rename to cmd/templ/infocmd/main.go index 96d09574a..eddd93200 100644 --- a/cmd/templ/diagnosecmd/main.go +++ b/cmd/templ/infocmd/main.go @@ -1,4 +1,4 @@ -package diagnosecmd +package infocmd import ( "context" @@ -17,27 +17,27 @@ import ( ) type Arguments struct { - JSON bool `flag:"json" help:"Output the diagnostics as JSON."` + JSON bool `flag:"json" help:"Output info as JSON."` } -type Diagnostics struct { +type Info struct { OS struct { GOOS string `json:"goos"` GOARCH string `json:"goarch"` } `json:"os"` - Go Diagnostic `json:"go"` - Gopls Diagnostic `json:"gopls"` - Templ Diagnostic `json:"templ"` + Go ToolInfo `json:"go"` + Gopls ToolInfo `json:"gopls"` + Templ ToolInfo `json:"templ"` } -type Diagnostic struct { +type ToolInfo struct { Location string `json:"location"` Version string `json:"version"` OK bool `json:"ok"` Message string `json:"message,omitempty"` } -func diagnoseGo() (d Diagnostic) { +func getGoInfo() (d ToolInfo) { // Find Go. var err error d.Location, err = exec.LookPath("go") @@ -57,7 +57,7 @@ func diagnoseGo() (d Diagnostic) { return } -func diagnoseGopls() (d Diagnostic) { +func getGoplsInfo() (d ToolInfo) { var err error d.Location, err = pls.FindGopls() if err != nil { @@ -75,7 +75,7 @@ func diagnoseGopls() (d Diagnostic) { return } -func diagnoseTempl() (d Diagnostic) { +func getTemplInfo() (d ToolInfo) { // Find templ. var err error d.Location, err = findTempl() @@ -118,40 +118,40 @@ func findTempl() (location string, err error) { return "", fmt.Errorf("templ is not in the path (%q). You can install templ with `go install github.com/a-h/templ/cmd/templ@latest`", os.Getenv("PATH")) } -func diagnose() (d Diagnostics) { +func getInfo() (d Info) { d.OS.GOOS = runtime.GOOS d.OS.GOARCH = runtime.GOARCH - d.Go = diagnoseGo() - d.Gopls = diagnoseGopls() - d.Templ = diagnoseTempl() + d.Go = getGoInfo() + d.Gopls = getGoplsInfo() + d.Templ = getTemplInfo() return } func Run(ctx context.Context, log *slog.Logger, stdout io.Writer, args Arguments) (err error) { - diagnostics := diagnose() + info := getInfo() if args.JSON { enc := json.NewEncoder(stdout) enc.SetIndent("", " ") - return enc.Encode(diagnostics) + return enc.Encode(info) } - log.Info("os", slog.String("goos", diagnostics.OS.GOOS), slog.String("goarch", diagnostics.OS.GOARCH)) - logDiagnostic(ctx, log, "go", diagnostics.Go) - logDiagnostic(ctx, log, "gopls", diagnostics.Gopls) - logDiagnostic(ctx, log, "templ", diagnostics.Templ) + log.Info("os", slog.String("goos", info.OS.GOOS), slog.String("goarch", info.OS.GOARCH)) + logInfo(ctx, log, "go", info.Go) + logInfo(ctx, log, "gopls", info.Gopls) + logInfo(ctx, log, "templ", info.Templ) return nil } -func logDiagnostic(ctx context.Context, log *slog.Logger, name string, d Diagnostic) { +func logInfo(ctx context.Context, log *slog.Logger, name string, ti ToolInfo) { level := slog.LevelInfo - if !d.OK { + if !ti.OK { level = slog.LevelError } args := []any{ - slog.String("location", d.Location), - slog.String("version", d.Version), + slog.String("location", ti.Location), + slog.String("version", ti.Version), } - if d.Message != "" { - args = append(args, slog.String("message", d.Message)) + if ti.Message != "" { + args = append(args, slog.String("message", ti.Message)) } log.Log(ctx, level, name, args...) } diff --git a/cmd/templ/main.go b/cmd/templ/main.go index 44d1770ad..ce6ad10ad 100644 --- a/cmd/templ/main.go +++ b/cmd/templ/main.go @@ -11,9 +11,9 @@ import ( "runtime" "github.com/a-h/templ" - "github.com/a-h/templ/cmd/templ/diagnosecmd" "github.com/a-h/templ/cmd/templ/fmtcmd" "github.com/a-h/templ/cmd/templ/generatecmd" + "github.com/a-h/templ/cmd/templ/infocmd" "github.com/a-h/templ/cmd/templ/lspcmd" "github.com/a-h/templ/cmd/templ/sloghandler" "github.com/fatih/color" @@ -36,7 +36,7 @@ commands: generate Generates Go code from templ files fmt Formats templ files lsp Starts a language server for templ files - diagnose Diagnose the templ environment + info Displays information about the templ environment version Prints the version ` @@ -46,8 +46,8 @@ func run(stdin io.Reader, stdout, stderr io.Writer, args []string) (code int) { return 64 // EX_USAGE } switch args[1] { - case "diagnose": - return diagnoseCmd(stdout, stderr, args[2:]) + case "info": + return infoCmd(stdout, stderr, args[2:]) case "generate": return generateCmd(stdout, stderr, args[2:]) case "fmt": @@ -84,13 +84,13 @@ func newLogger(logLevel string, verbose bool, stderr io.Writer) *slog.Logger { })) } -const diagnoseUsageText = `usage: templ diagnose [...] +const infoUsageText = `usage: templ info [...] -Diagnoses the templ environment. +Displays information about the templ environment. Args: -json - Output diagnostics in JSON format to stdout. (default false) + Output information in JSON format to stdout. (default false) -v Set log verbosity level to "debug". (default "info") -log-level @@ -99,7 +99,7 @@ Args: Print help and exit. ` -func diagnoseCmd(stdout, stderr io.Writer, args []string) (code int) { +func infoCmd(stdout, stderr io.Writer, args []string) (code int) { cmd := flag.NewFlagSet("diagnose", flag.ExitOnError) jsonFlag := cmd.Bool("json", false, "") verboseFlag := cmd.Bool("v", false, "") @@ -107,11 +107,11 @@ func diagnoseCmd(stdout, stderr io.Writer, args []string) (code int) { helpFlag := cmd.Bool("help", false, "") err := cmd.Parse(args) if err != nil { - fmt.Fprint(stderr, diagnoseUsageText) + fmt.Fprint(stderr, infoUsageText) return 64 // EX_USAGE } if *helpFlag { - fmt.Fprint(stdout, diagnoseUsageText) + fmt.Fprint(stdout, infoUsageText) return } @@ -126,7 +126,7 @@ func diagnoseCmd(stdout, stderr io.Writer, args []string) (code int) { cancel() }() - err = diagnosecmd.Run(ctx, log, stdout, diagnosecmd.Arguments{ + err = infocmd.Run(ctx, log, stdout, infocmd.Arguments{ JSON: *jsonFlag, }) if err != nil { diff --git a/cmd/templ/main_test.go b/cmd/templ/main_test.go index 23c9b1d18..5f05982c5 100644 --- a/cmd/templ/main_test.go +++ b/cmd/templ/main_test.go @@ -66,9 +66,9 @@ func TestMain(t *testing.T) { expectedCode: 0, }, { - name: `"templ diagnose --help" prints usage`, - args: []string{"templ", "diagnose", "--help"}, - expectedStdout: diagnoseUsageText, + name: `"templ info --help" prints usage`, + args: []string{"templ", "info", "--help"}, + expectedStdout: infoUsageText, expectedCode: 0, }, } From bdb9b551db5945c7f0f888559514c268ece94209 Mon Sep 17 00:00:00 2001 From: Adrian Hesketh Date: Mon, 8 Jul 2024 11:02:55 +0100 Subject: [PATCH 4/5] refactor: rename to info --- docs/docs/09-commands-and-tools/01-cli.md | 2 +- docs/docs/09-commands-and-tools/02-ide-support.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/09-commands-and-tools/01-cli.md b/docs/docs/09-commands-and-tools/01-cli.md index 113c7fe84..6d74fd5cd 100644 --- a/docs/docs/09-commands-and-tools/01-cli.md +++ b/docs/docs/09-commands-and-tools/01-cli.md @@ -13,7 +13,7 @@ commands: generate Generates Go code from templ files fmt Formats templ files lsp Starts a language server for templ files - diagnose Diagnose the templ environment + info Displays information about the templ environment version Prints the version ``` diff --git a/docs/docs/09-commands-and-tools/02-ide-support.md b/docs/docs/09-commands-and-tools/02-ide-support.md index 45f03d8a9..1d1f16f3a 100644 --- a/docs/docs/09-commands-and-tools/02-ide-support.md +++ b/docs/docs/09-commands-and-tools/02-ide-support.md @@ -434,6 +434,6 @@ The logs can be quite verbose, since almost every keypress results in additional The web server option provides an insight into the internal state of the language server. It may provide insight into what's going wrong. -### Run templ diagnose +### Run templ info -The `templ diagnose` command outputs information that's useful in debugging issues. +The `templ info` command outputs information that's useful for debugging issues. From 9039fa7875bdbc217475ac2c95933c14b798fd3c Mon Sep 17 00:00:00 2001 From: Adrian Hesketh Date: Mon, 8 Jul 2024 11:03:51 +0100 Subject: [PATCH 5/5] chore: update issue template --- .github/ISSUE_TEMPLATE/bug_report.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9b40208ac..ef2ce9125 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -25,8 +25,8 @@ If applicable, add screenshots or screen captures to help explain your problem. **Logs** If the issue is related to IDE support, run through the LSP troubleshooting section at https://templ.guide/commands-and-tools/ide-support/#troubleshooting-1 and include logs from templ -**`templ diagnose` output** -Run `templ diagnose` and include the output. +**`templ info` output** +Run `templ info` and include the output. **Desktop (please complete the following information):** - OS: [e.g. MacOS, Linux, Windows, WSL]