Skip to main content
Version: v5.7.1

opschain context show

Included from Basic tier

opschain context show [name]

Without an argument, show the resolved active target — which honours the full precedence, so with --server or OPSCHAIN_SERVER set it reports that ad-hoc target (Context: (ad-hoc flag) / (ad-hoc env)) rather than the contexts file's current entry:

opschain context show
Context: production
Server: https://opschain.example.com
Home: /Users/op/Library/Application Support/opschain (the per-OS default)

The last line always names the home the contexts file was read from and how that home was chosen: from --home, from OPSCHAIN_HOME, or the per-OS default — each shell can select a different home, and each home carries its own active context. In local mode it prints Context: local (local mode); when the home has no contexts.json at all it says so — Context: local (local mode — no contexts.json in <home>) — so a home that was never logged in from is distinguishable from one switched back to local. With a name, show that defined context regardless of what is active; the reserved name local always shows local mode. -o json|yaml emits context, server (null in local mode), source (flag, env, context or local), home (the resolved home path) and home_source (flag, OPSCHAIN_HOME or default).

A name that is not defined errors with context "<name>" is not defined — the full message names the opschain login invocation that creates it (exit 1).

Exit codes: 0 on success, 1 for an undefined name or an unreadable contexts file, 2 for a usage error.

See also​

  • opschain docs cli/context-list — all contexts at once.
  • opschain docs cli/context-use — make one active.