From 5a7d06e3a9aa9d7317e2d5b7de3328a4713541b9 Mon Sep 17 00:00:00 2001 From: Jaehoon <77257966+hoonman@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:06:55 +0000 Subject: [PATCH 1/2] Added bash command requirement for bash Co-authored-by: Tienbruh Co-authored-by: JesusG2022 --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 525c1b5aaf..2251688ea0 100644 --- a/README.md +++ b/README.md @@ -642,3 +642,31 @@ 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 (Temporary) +Using the following sequence of commands for each shell will temporarily activate autocompletion for the CLI. However, when the terminal is restarted or closed, the autocompletion commands will need to be run again to reactivate it. + +#### 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)" +``` + +5. Try on CLI +```shell +openai +``` From f95433c906b1b2b6b6d7af61c4a66f6143bbfa71 Mon Sep 17 00:00:00 2001 From: Jaehoon <77257966+hoonman@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:19:35 +0000 Subject: [PATCH 2/2] edit readme structure Co-authored-by: Tienbruh Co-authored-by: JesusG2022 --- README.md | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2251688ea0..95bfbb1d90 100644 --- a/README.md +++ b/README.md @@ -645,9 +645,8 @@ Python 3.7 or higher. ## Activating CLI Autocomplete -### Using CLI Autocomplete (Temporary) -Using the following sequence of commands for each shell will temporarily activate autocompletion for the CLI. However, when the terminal is restarted or closed, the autocompletion commands will need to be run again to reactivate it. - +### 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 @@ -658,7 +657,6 @@ pip install openai ```shell activate-global-python-argcomplete ``` - 3. Restart your terminal 4. Register ‘openai’ command for argument completion by running: @@ -666,7 +664,32 @@ activate-global-python-argcomplete 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