@@ -20,7 +20,11 @@ let usage = `Usage:
2020 [--watch] | Runs this command in watch mode.
2121
2222 unused-selections | Check if we there are unused selections in your EdgeQL queries.
23- [--ci] | Run in CI mode.`
23+ [--ci] | Run in CI mode.
24+
25+ ui-url | Get the URL for opening the local EdgeDB UI.
26+
27+ extract <filePath> | Extract all %edgeql tags in file at <filePath>.`
2428
2529type config = {client : EdgeDB .Client .t }
2630
@@ -72,7 +76,7 @@ let main = async () => {
7276 dict
7377 })
7478 -> JSON .stringifyAny
75- -> Option .getWithDefault ("" )
79+ -> Option .getOr ("" )
7680 -> NodeJs .Buffer .fromString ,
7781 )
7882 }
@@ -169,8 +173,21 @@ let main = async () => {
169173
170174 {client : client }
171175 },
172- ~handleOtherCommand = async ({args , command }) => {
176+ ~handleOtherCommand = async ({args , command , config }) => {
173177 switch command {
178+ | "ui-url" =>
179+ let getNormalizedConfig : EdgeDB .Client .t => promise <
180+ 'a ,
181+ > = %raw (` async function getNormalizedConfig (client ) {
182+ return (await client .pool ._getNormalizedConnectConfig ()).connectionParams
183+ }` )
184+
185+ let connectionConfig = await getNormalizedConfig (config .client )
186+
187+ let url = ` http://${connectionConfig["address" ]-> Array.joinWith(
188+ ":" ,
189+ )}/ui/${connectionConfig["database" ]}`
190+ Console .log (url )
174191 | "unused-selections" =>
175192 let ci = args -> RescriptEmbedLang .CliArgs .hasArg ("--ci" )
176193
@@ -198,7 +215,7 @@ let main = async () => {
198215 content
199216 -> String .split ("# @name " )
200217 -> Array .get (1 )
201- -> Option .getWithDefault ("" )
218+ -> Option .getOr ("" )
202219 -> String .split (" " )
203220 -> Array .get (0 )
204221 -> Option .map (EdgeDbGenerator__Utils .capitalizeString )
@@ -224,7 +241,7 @@ let main = async () => {
224241 while ! break .contents {
225242 let currentLineCount = lineCount .contents
226243 lineCount := currentLineCount + 1
227- let line = lines -> Array .get (currentLineCount )-> Option .getWithDefault ("" )
244+ let line = lines -> Array .get (currentLineCount )-> Option .getOr ("" )
228245 if line -> String .includes ("@name" ) {
229246 switch line -> String .split ("# @name " ) {
230247 | [before , _after ] =>
@@ -350,7 +367,7 @@ let transaction = (transaction: EdgeDB.Transaction.t${hasArgs
350367 let migrations =
351368 (await config .client
352369 -> EdgeDB .QueryHelpers .single ("select count(schema::Migration)" ))
353- -> Option .getWithDefault (- 1 )
370+ -> Option .getOr (- 1 )
354371
355372 debug (` [schema change detection] Found ${migrations-> Int.toString} migrations` )
356373 let currentMigrationsCount = migrationsCount .contents
0 commit comments