forked from contextforge-org/contextforge-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogout.py
More file actions
27 lines (22 loc) · 785 Bytes
/
Copy pathlogout.py
File metadata and controls
27 lines (22 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
"""Location: ./cforge/commands/settings/logout.py
Copyright 2025
SPDX-License-Identifier: Apache-2.0
Authors: Gabe Goodhart
CLI command: logout
"""
# Local
from cforge.common.console import get_console
from cforge.common.http import get_token_file
def logout() -> None:
"""Remove stored authentication token.
This command removes the token saved in ~/.contextforge/token.
"""
console = get_console()
token_file = get_token_file()
if token_file.exists():
token_file.unlink()
console.print(f"[green]✓ Token removed from {token_file}[/green]")
console.print("[cyan]You will need to login again to use authenticated commands.[/cyan]")
else:
console.print("[yellow]No stored token found.[/yellow]")