-
Notifications
You must be signed in to change notification settings - Fork 306
Add ZSH-style history command support to terminal #1282
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: bummoblizard <[email protected]>
Co-authored-by: bummoblizard <[email protected]>
Co-authored-by: bummoblizard <[email protected]>
history -c to clear terminal command history
| } else { | ||
| // Display history - pass to ios_system for default behavior | ||
| executor?.dispatch(command: x, isInteractive: false) { _ in | ||
| DispatchQueue.main.async { | ||
| self.readLine() | ||
| } | ||
| } | ||
| } |
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.
Can we use fallthrough here?
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.
Good suggestion! Changed to use fallthrough in commit 8ff488f. This eliminates code duplication and makes it cleaner.
|
@copilot evaluate my comment and make any necessary changes |
Use fallthrough to default case instead of duplicating dispatch logic, as suggested in code review. Co-authored-by: bummoblizard <[email protected]> Co-authored-by: bummoblizard <[email protected]>
|
@copilot Make the following changes:
|
- Change clear command from -c to -p (following ZSH) - Add history display with index in 2-column format when no args - Add usage guidance for --help and invalid options - Display "history: invalid option" message for incorrect arguments Co-authored-by: bummoblizard <[email protected]>
Implemented all requested changes in commit f445f5d:
The implementation now follows ZSH conventions:
|
history -c to clear terminal command history|
@copilot Address the comments |
All previous comments have been addressed:
Could you clarify which specific comments need further attention? |
|
@copilot The ZSH history command only prints the last 25 commands in history. Make sure you mimic this behavior |
Modified history command to display only the last 25 commands when no arguments are provided, matching ZSH default behavior. Co-authored-by: bummoblizard <[email protected]>
Updated in commit 6cf74bd to display only the last 25 commands, matching ZSH default behavior. The history now uses |
historycommand handler in Swift (TerminalInstance.swift)Summary
Successfully implemented comprehensive
historycommand support with ZSH-style behavior. The implementation provides command history display with indexing, clearing functionality, and helpful usage guidance, matching ZSH's default behavior of showing only the last 25 commands.Implementation
TerminalInstance.swiftforhistorycommandshistory(no arguments) displays the last 25 command history entries with index numbers in 2-column tabbed format (index, command) - matching ZSH default behaviorhistory -pclears JavaScript-based history in local-echo.js (following ZSH convention)history --helporhistory -hdisplays usage information--helpFeatures
historywithout arguments shows the last 25 commands with their index numbers in a clean 2-column format (ZSH default behavior)history -pclears all command history (ZSH-style)--helpor-hflagsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.