()
| 2241 | }; |
| 2242 | |
| 2243 | const printServerProfiles = () => |
| 2244 | Effect.gen(function* () { |
| 2245 | const store = yield* readCliServerConnectionStore(); |
| 2246 | if (store.profiles.length === 0) { |
| 2247 | console.log("No server profiles configured."); |
| 2248 | console.log(`Add one: ${cliPrefix} server add local ${DEFAULT_BASE_URL} --default`); |
| 2249 | return; |
| 2250 | } |
| 2251 | |
| 2252 | const rows = store.profiles.map((profile) => ({ |
| 2253 | marker: profile.name === store.defaultProfile ? "*" : " ", |
| 2254 | name: profile.name, |
| 2255 | kind: profile.connection.kind, |
| 2256 | origin: profile.connection.origin, |
| 2257 | displayName: profile.connection.displayName, |
| 2258 | auth: profile.connection.auth ? "stored-auth" : "env-auth", |
| 2259 | headers: profile.connection.headers |
| 2260 | ? `${Object.keys(profile.connection.headers).length} header-env` |
| 2261 | : "no-headers", |
| 2262 | })); |
| 2263 | const nameWidth = rows.reduce((max, row) => Math.max(max, row.name.length), 4); |
| 2264 | const kindWidth = rows.reduce((max, row) => Math.max(max, row.kind.length), 4); |
| 2265 | |
| 2266 | for (const row of rows) { |
| 2267 | console.log( |
| 2268 | `${row.marker} ${row.name.padEnd(nameWidth)} ${row.kind.padEnd(kindWidth)} ${row.origin} ${row.displayName} ${row.auth} ${row.headers}`, |
| 2269 | ); |
| 2270 | } |
| 2271 | }); |
| 2272 | |
| 2273 | const serverAddCommand = Command.make( |
| 2274 | "add", |
no test coverage detected