()
| 2170 | }; |
| 2171 | |
| 2172 | const printServerProfiles = () => |
| 2173 | Effect.gen(function* () { |
| 2174 | const store = yield* readCliServerConnectionStore(); |
| 2175 | if (store.profiles.length === 0) { |
| 2176 | console.log("No server profiles configured."); |
| 2177 | console.log(`Add one: ${cliPrefix} server add local ${DEFAULT_BASE_URL} --default`); |
| 2178 | return; |
| 2179 | } |
| 2180 | |
| 2181 | const rows = store.profiles.map((profile) => ({ |
| 2182 | marker: profile.name === store.defaultProfile ? "*" : " ", |
| 2183 | name: profile.name, |
| 2184 | kind: profile.connection.kind, |
| 2185 | origin: profile.connection.origin, |
| 2186 | displayName: profile.connection.displayName, |
| 2187 | auth: profile.connection.auth ? "stored-auth" : "env-auth", |
| 2188 | })); |
| 2189 | const nameWidth = rows.reduce((max, row) => Math.max(max, row.name.length), 4); |
| 2190 | const kindWidth = rows.reduce((max, row) => Math.max(max, row.kind.length), 4); |
| 2191 | |
| 2192 | for (const row of rows) { |
| 2193 | console.log( |
| 2194 | `${row.marker} ${row.name.padEnd(nameWidth)} ${row.kind.padEnd(kindWidth)} ${row.origin} ${row.displayName} ${row.auth}`, |
| 2195 | ); |
| 2196 | } |
| 2197 | }); |
| 2198 | |
| 2199 | const serverAddCommand = Command.make( |
| 2200 | "add", |
no test coverage detected