-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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">
- Loading branch information
Showing
2 changed files
with
99 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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