()
| 2114 | }; |
| 2115 | |
| 2116 | const printServerProfiles = () => |
| 2117 | Effect.gen(function* () { |
| 2118 | const store = yield* readCliServerConnectionStore(); |
| 2119 | if (store.profiles.length === 0) { |
| 2120 | console.log("No server profiles configured."); |
| 2121 | console.log(`Add one: ${cliPrefix} server add local ${DEFAULT_BASE_URL} --default`); |
| 2122 | return; |
| 2123 | } |
| 2124 | |
| 2125 | const rows = store.profiles.map((profile) => ({ |
| 2126 | marker: profile.name === store.defaultProfile ? "*" : " ", |
| 2127 | name: profile.name, |
| 2128 | kind: profile.connection.kind, |
| 2129 | origin: profile.connection.origin, |
| 2130 | displayName: profile.connection.displayName, |
| 2131 | auth: profile.connection.auth ? "stored-auth" : "env-auth", |
| 2132 | })); |
| 2133 | const nameWidth = rows.reduce((max, row) => Math.max(max, row.name.length), 4); |
| 2134 | const kindWidth = rows.reduce((max, row) => Math.max(max, row.kind.length), 4); |
| 2135 | |
| 2136 | for (const row of rows) { |
| 2137 | console.log( |
| 2138 | `${row.marker} ${row.name.padEnd(nameWidth)} ${row.kind.padEnd(kindWidth)} ${row.origin} ${row.displayName} ${row.auth}`, |
| 2139 | ); |
| 2140 | } |
| 2141 | }); |
| 2142 | |
| 2143 | const serverAddCommand = Command.make( |
| 2144 | "add", |
no test coverage detected