()
| 2139 | }; |
| 2140 | |
| 2141 | const printServerProfiles = () => |
| 2142 | Effect.gen(function* () { |
| 2143 | const store = yield* readCliServerConnectionStore(); |
| 2144 | if (store.profiles.length === 0) { |
| 2145 | console.log("No server profiles configured."); |
| 2146 | console.log(`Add one: ${cliPrefix} server add local ${DEFAULT_BASE_URL} --default`); |
| 2147 | return; |
| 2148 | } |
| 2149 | |
| 2150 | const rows = store.profiles.map((profile) => ({ |
| 2151 | marker: profile.name === store.defaultProfile ? "*" : " ", |
| 2152 | name: profile.name, |
| 2153 | kind: profile.connection.kind, |
| 2154 | origin: profile.connection.origin, |
| 2155 | displayName: profile.connection.displayName, |
| 2156 | auth: profile.connection.auth ? "stored-auth" : "env-auth", |
| 2157 | })); |
| 2158 | const nameWidth = rows.reduce((max, row) => Math.max(max, row.name.length), 4); |
| 2159 | const kindWidth = rows.reduce((max, row) => Math.max(max, row.kind.length), 4); |
| 2160 | |
| 2161 | for (const row of rows) { |
| 2162 | console.log( |
| 2163 | `${row.marker} ${row.name.padEnd(nameWidth)} ${row.kind.padEnd(kindWidth)} ${row.origin} ${row.displayName} ${row.auth}`, |
| 2164 | ); |
| 2165 | } |
| 2166 | }); |
| 2167 | |
| 2168 | const serverAddCommand = Command.make( |
| 2169 | "add", |
no test coverage detected