Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where command history added to shell was incompatible with fish format, corrupting history #142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mooz
Copy link

@mooz mooz commented Mar 23, 2025

Fix fish shell history format handling

Problem

The current implementation corrupts the fish shell history file by appending commands in an incorrect format. The fish shell history file uses a YAML-like format rather than simple newline-separated entries.

Solution

Implemented shell-specific handlers to properly read and write to each shell's history file according to its specific format.

Changes

  • Created a ShellHistoryHandler interface
  • Implemented a SimpleHistoryHandler class for basic shells (bash, sh, ksh, tcsh)
  • Implemented a ZshHistoryHandler class for zsh (handling timestamp format)
  • Implemented a FishHistoryHandler class for fish (handling YAML-like format)
  • Updated main functions to use the appropriate handler based on the detected shell

Testing

  • Verified history files are correctly updated after command execution in bash, zsh, and fish shells
  • Specifically confirmed the fish shell history file is no longer corrupted

@steve8708
Copy link
Contributor

thanks @mooz - looks like build not passing though

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.

2 participants