logout: rename --all to --all-contexts · Entire
logout: rename --all to --all-contexts
df83448·
toothbrush·1mo ago·3 files·+24 added/-23 removed
--all was ambiguous next to --everywhere (all devices vs all logins).
--all-contexts says what it does: drain every saved login context. Updates the flag, help text, doc comments, and tests. Also corrects stale "--all" wording in TestRunLogout_AllRevokesAllSessions, which exercises the --everywhere path.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
446db5e8b03dView transcript
Changes
3
cmd/entire/cli
auth
Mcontext_store.go+3/-3
Mlogout.go+10/-9
Mlogout_test.go+11/-11
54 unmodified lines
}```
// RemoveContext deletes the named context from contexts.json and its keyring
// tokens. A missing context is a no-op. Used by `logout --all` to drain every
// saved login. File.Delete clears current_context when name was the active
// one, so removing the current context this way also logs it out.
// tokens. A missing context is a no-op. Used by `logout --all-contexts` to
// drain every saved login. File.Delete clears current_context when name was
// the active one, so removing the current context this way also logs it out.
func RemoveContext(name string) error {
var svc, handle string
if err := contexts.Modify(contexts.DefaultConfigDir(), func(f *contexts.File) (bool, error) {
Mcmd/entire/cli/auth/context_store.go+3/-3
34 unmodified lines
func newLogoutCmd() *cobra.Command {
var insecureHTTPAuth bool
var everywhere bool
var all bool
var allContexts bool
cmd := &cobra.Command{
Use: "logout",
Short: "Log out of Entire"
// ... other command configurations
}
return cmd
}
// revokeTargetFunc revokes sessions on a specific core. The two production
// implementations are revokeCurrentSession (just the bearer's own session)
// and revokeAllSessions (every session on that core); `logout --all` picks
// and revokeAllSessions (every session on that core); `logout --all-contexts` picks
// one based on --everywhere and applies it to each saved context's core.
type revokeTargetFunc func(ctx context.Context, coreURL, token string) error
// TestLogoutCommand_FlagMatrix pins all four quadrants of the --all/--everywhere
// TestLogoutCommand_FlagMatrix pins all four quadrants of the --all-contexts/--everywhere
// matrix end-to-end through the cobra command, asserting which revoke shape each
// context's core actually received. Process-global env + keyring backend, so no
// t.Parallel(); subtests run sequentially, each with fresh state.
func TestLogoutCommand_FlagMatrix(t *testing.T) { t.Run("--all: every context, current session each", func(t *testing.T) { // ... execution details })
t.Run("--all --everywhere: every context, all sessions each", func(t *testing.T) { // ... execution details }) }