feat(session): restore the saved session with --session=last

This commit is contained in:
BlackAngelTV committed 2026-11-11 21:03:29 +01:00
1 parent 9663b74488
commit fd3b782889
1 file changed
+9 -1
+9 -1
View File
@@ -327,7 +327,15 @@ def create_sessions(
env_when_no_session: dict[str, str] | None = None,
) -> Iterator[Session]:
if args and args.session:
if args.session == 'none':
if args.session == 'last':
from .session_restore import load_last_session, state_path
raw = load_last_session()
if raw:
yield from parse_session(raw, opts, session_arg='last', session_path=state_path())
return
log_error('There is no saved session to restore, starting a new session instead')
elif args.session == 'none':
default_session = 'none'
else:
session_arg = args.session