mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
feat(ocm-cli): label the attached manager with an optional login name
This commit is contained in:
1 parent
612b0e6621
commit
8b428837c3
6 files changed
+66
-8
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user