feat(ocm-cli): label the attached manager with an optional login name

This commit is contained in:
Chris Scott committed 2026-10-17 20:09:00 -04:00
1 parent 612b0e6621
commit 8b428837c3
6 files changed
+66 -8

No files matched your search

+9
View File
@@ -1,3 +1,6 @@
import type { OcmState } from './state.js'
import { normalizeManagerUrl } from './manager-auth.js'
export const REMOTE_MANAGER_URL_ENV = 'OCM_REMOTE_MANAGER_URL'
export const REMOTE_REPO_NAME_ENV = 'OCM_REMOTE_REPO_NAME'
export const REMOTE_REPO_ID_ENV = 'OCM_REMOTE_REPO_ID'
@@ -37,3 +40,9 @@ export function readRemoteContext(env: NodeJS.ProcessEnv): RemoteContext | undef
return { managerUrl, managerHost, repoName, repoId }
}
/** Returns the saved manager name when it belongs to the attached manager, else the manager host. */
export function remoteDisplayName(remote: RemoteContext, state: OcmState | null): string {
if (state?.managerName && normalizeManagerUrl(state.managerUrl) === normalizeManagerUrl(remote.managerUrl)) return state.managerName
return remote.managerHost
}