feat: ✨ HSTRFILE environment variable for per-process isolation#547
Open
xobes wants to merge 1 commit into
Open
feat: ✨ HSTRFILE environment variable for per-process isolation#547xobes wants to merge 1 commit into
xobes wants to merge 1 commit into
Conversation
… combined history for all shells
There was a problem hiding this comment.
Pull request overview
This pull request adds support for a new HSTRFILE environment variable that allows users to specify a separate history file for hstr, independent of the shell's HISTFILE. This enables use cases where each shell instance maintains its own history file while hstr can access a global history file.
Changes:
- Added
ENV_VAR_HSTRFILEconstant definition - Modified
get_history_file_name()to checkHSTRFILEbefore falling back toHISTFILE
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/include/hstr_history.h | Defines the new HSTRFILE environment variable constant |
| src/hstr_history.c | Implements fallback logic: HSTRFILE → HISTFILE → defaults |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supports global hstr file and separate history file per shell.
E.g. source the following file and each bash shell will have it's own .history file per PID as well as a global. This way, each shell has it's own history (up/down arrows) which is unique to that shell; but also has access to the overall history (Ctrl-R).
(Note: these per-pid files don't get deleted presently, so that's something that needs to be considered)
hstr_sync_example.sh