From f4c5020f63abff6c826e99bffcd51b50cb0b1a90 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Mon, 29 Aug 2022 14:37:18 +0300 Subject: [PATCH] fix: Print postgres-builtin-url to stdout without formatting (#3727) This allows use-cases like `eval $(coder server postgres-builtin-url)`. --- cli/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/server.go b/cli/server.go index 0a1d1ca364..c2b20b660c 100644 --- a/cli/server.go +++ b/cli/server.go @@ -659,13 +659,13 @@ func Server(newAPI func(*coderd.Options) *coderd.API) *cobra.Command { root.AddCommand(&cobra.Command{ Use: "postgres-builtin-url", Short: "Output the connection URL for the built-in PostgreSQL deployment.", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { cfg := createConfig(cmd) url, err := embeddedPostgresURL(cfg) if err != nil { return err } - cmd.Println(cliui.Styles.Code.Render("psql \"" + url + "\"")) + _, _ = fmt.Fprintf(cmd.OutOrStdout(), "psql %q\n", url) return nil }, })