-
Notifications
You must be signed in to change notification settings - Fork 7
Feature/command history #27
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
Conversation
…main Signed-off-by: Viswaijth K S <[email protected]>
Replaced all direct calls to 'exec.Command' throughout the 'internal/git' package with a single, central 'executeCommand' method. This ensures all git operations are now consistently logged to the application log file for easier debugging. Signed-off-by: Viswaijth K S <[email protected]>
…e calls in the internal/git package
Adds a file-based logger for debugging and displays a real-time, session-based command history in the secondary panel.
|
Please mark the PR as ready for review when you think you are done with the implementation, if you feel stuck feel free to reach out. |
|
Hello @viswajith-ks
|
|
I will mark this PR as a draft, you can mark it as ready for review when the issues I raised above have been addressed. |
|
thanks for the reply! will work on it |
|
Hi, sorry for the late response, I will check the changes out and update you soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one change I would like you to address, right now as indicated by your screenshot if there is an error it logs the full error in a long line that goes out of scope, make it so that only the useful part of the error is logged and not the whole trace.
For Example, Instead of:
Error: stash operation failed: exit status 128: fatal: log for 'stash' only has 1 entriesIt could say something like:
[ERROR - 128] fatal: log for 'stash' only has 1 entries
Things to note:
- The error block
[ERROR - 128]should be colored, add a field for that in the themes struct inthemes.goand probably use red or bright red as the color, it should stand out in the logs.
Follow any such pattern so that its easier to read the error output and the history does not become cluttered,
Some Other changes:
- There should be a newline between each command log.
- In your implementation the history logs goes from top to bottom, that is a new log is added at the bottom, it would be easier for the user to follow if it were the opposite, new logs should be added to the top.
b13345e to
8b83f65
Compare
|
the requested changes: error formatting, newline separator and history order have been made. thanks for being patient with me |
|
@viswajith-ks Thank you for the contribution! ^^ |




Closes #19
Hi! This PR is ready for review and implements the command history and logging feature.
Changes Implemented
loggerpackage now writes all executed git commands and errors to~/.gitx.logfor debugging.[6] Command Historypanel. The history is session-based and clears on restart.internal/gitpackage to use a single, centralexecuteCommandmethod. This was done to ensure all commands could be logged consistently and to make the code more maintainable going forward.A Note on the Refactor
As this is my first major contribution to the project, I wanted to be thorough. I noticed that logging would require touching every git command, so I opted to centralize the command execution logic first. This ended up touching most of the files in the
internal/gitdirectory.My goal was to follow the existing patterns in the codebase while making the new feature robust. I'm especially eager for any feedback you have on this approach, and I'm happy to make any changes or discuss it further.
Thanks for the opportunity to contribute!