diff --git a/README.md b/README.md index 525c1b5aaf..95bfbb1d90 100644 --- a/README.md +++ b/README.md @@ -642,3 +642,54 @@ We are keen for your feedback; please open an [issue](https://www.github.com/ope ## Requirements Python 3.7 or higher. + +## Activating CLI Autocomplete + +### Using CLI Autocomplete +Using the following sequence of commands for each shell will activate the autocompletion feature for the CLI. +#### Bash +1. Install openai if not installed yet. +```shell +pip install openai +``` + +2. Configure your shell to support global auto completion for python scripts by running: +```shell +activate-global-python-argcomplete +``` +3. Restart your terminal + +4. Register ‘openai’ command for argument completion by running: +```shell +eval "$(register-python-argcomplete openai)" +``` + +Alternatively, run this command to enable argcomplete persistently, eliminating the need to run the eval command every time the terminal is restarted or reloaded. Restart your terminal after using this command. +```shell +register-python-argcomplete openai >> ~/.bashrc +``` + +5. Try on CLI +```shell +openai +``` + +#### Powershell +1. Install openai if not installed already. +```shell +pip install openai +``` +2. Create new completion file: +```shell +register-python-argcomplete --shell powershell openai > ~/openai.psm1 +``` + +3. Open the [``$PROFILE``](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.4&viewFallbackFrom=powershell-7.3#how-to-create-a-profile) by running ``notepad $PROFILE`` and add this following line: +```shell +Import-Module "~/openai.psm1" +``` + +4. Restart the terminal and try: +```shell +openai +``` \ No newline at end of file