-
Notifications
You must be signed in to change notification settings - Fork 76
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
Feature: Add selected command to shell history #39
Comments
8 tasks
Merged
ShishirPatil
added a commit
that referenced
this issue
Oct 19, 2023
- [X] Append command to user bash history and prefill shell. Even though we can append command to bash history, it does not show up in the reverse-i-search without sourcing the shell. This is because the child process cannot modify the environment of the parent caller process [stack-overflow reference](https://stackoverflow.com/questions/3661566/python-source-home-bashrc-with-os-system). So, instead will will pre-fill the shell command with the selected command. - [X] Get OS environment - [X] Refactor unique ID generation - mostly cosmetic - [x] Update server to route LLM based on os environment - [x] Test on Ubuntu Linux - [x] Test on Darwin (Mac OS) - [ ] Test on WSL - [ ] Test on Windows Powershell Thoughts, suggestions, and reviews welcome! Relevant to #39 and #12
ShishirPatil
pushed a commit
that referenced
this issue
Oct 19, 2023
The history feature (`-p` or `--history`) will allow users to find their past commands executed and execute them using the questionary selection feature. The history will be stored in `~/.gorilla_cli_history` and currently, it is set so that the newest 5 commands in the history will be displayable (there is an adjustable constant for `HISTORY_LENGTH`). Repeated executions of the same command within the most recent 5 commands will not be appended to the history, but as long as that command is out of the recent window, it is again able to be added to the history list. This is to prevent cluttering of the history by repeated executions of the same command consecutively. This address the issue #39 for bash history appending for executed commands. Since the CLI, using python, runs on a separate subprocess than the current user's shell, it is against best security practices to violate this subprocess distinction and force write to a global history. As well, since different shells work differently when tracking history (zsh, bash, cmd.exe), it is also a very big hassle to introduce cross-platform support. This is why I opted for this in-house history solution. <img width="692" alt="image" src="https://github.com/gorilla-llm/gorilla-cli/assets/65890703/a1edd64f-a0da-4df6-a9c1-0b177bb4d0bb">
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently whatever command is selected is not added to the command history of the shell.
This makes rerunning commands a pain and I have to instead rerun the gorilla command instead.
It would be very nice to have the command executed directly on the shell in a way that adds it to the command history.
The text was updated successfully, but these errors were encountered: