Skip to content

Commit f4c5020

Browse files
authored
fix: Print postgres-builtin-url to stdout without formatting (coder#3727)
This allows use-cases like `eval $(coder server postgres-builtin-url)`.
1 parent b9b9c2f commit f4c5020

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cli/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,13 +659,13 @@ func Server(newAPI func(*coderd.Options) *coderd.API) *cobra.Command {
659659
root.AddCommand(&cobra.Command{
660660
Use: "postgres-builtin-url",
661661
Short: "Output the connection URL for the built-in PostgreSQL deployment.",
662-
RunE: func(cmd *cobra.Command, args []string) error {
662+
RunE: func(cmd *cobra.Command, _ []string) error {
663663
cfg := createConfig(cmd)
664664
url, err := embeddedPostgresURL(cfg)
665665
if err != nil {
666666
return err
667667
}
668-
cmd.Println(cliui.Styles.Code.Render("psql \"" + url + "\""))
668+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "psql %q\n", url)
669669
return nil
670670
},
671671
})

0 commit comments

Comments
 (0)