Skip to content

feat: persist session state to ~/.reqsh_state.json#20

Merged
hars-21 merged 4 commits into
hars-21:mainfrom
Bircoder432:main
Jul 8, 2026
Merged

feat: persist session state to ~/.reqsh_state.json#20
hars-21 merged 4 commits into
hars-21:mainfrom
Bircoder432:main

Conversation

@Bircoder432

Copy link
Copy Markdown
Contributor
  • Add Serialize/Deserialize to Request and Method
  • Add save/load methods to ShellState using serde_json
  • Restore state on startup, fallback to empty state on error
  • Skip last_request during serialization as it is transient
  • Add unit tests for state serialization roundtrip

Closes #12

- Add Serialize/Deserialize to Request and Method
- Add save/load methods to ShellState using serde_json
- Restore state on startup, fallback to empty state on error
- Skip last_request during serialization as it is transient
- Add unit tests for state serialization roundtrip

Closes hars-21#12
@Bircoder432 Bircoder432 requested a review from hars-21 as a code owner July 7, 2026 08:56

@hars-21 hars-21 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pressing Ctrl+D (EOF) or Ctrl+C (Interrupted) skips save(). Users will lose state unexpectedly.

Add save() calls in both the branches

Comment thread src/state.rs Outdated
base_url: Option<String>,
headers: HashMap<String, String>,
variables: HashMap<String, String>,
#[serde(skip)]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not skip timeout as running reqsh --timeout 30 discards any previously saved session state.

@Bircoder432

Copy link
Copy Markdown
Contributor Author

Fixed

@hars-21 hars-21 merged commit 518cafd into hars-21:main Jul 8, 2026
1 check passed
@hars-21

hars-21 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Awesome work thanks for contributing! I've merged your PR. Looking forward to seeing more contributions from you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Session persistence

2 participants