feat(session): restore the last session with --session=last #40

Closed
BlackAngelTV wants to merge 25 commits from feat/session-restore into main
pull from: feat/session-restore
Showing only changes of commit fd3b782889 - Show all commits
+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