Skip to content

Added bash command requirement for bash in the readme file #3

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

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <TAB>
```

#### 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 <TAB>
```