gcli is a command-line interface (CLI) tool for using ChatGPT. It allows you to interact with the ChatGPT language model directly from your terminal. The current version supports GPT-4, with plans to add support for new versions in the future. The project is written in pure Go.
You can use this table of contents as a quick reference to navigate through the document.
If you prefer to build gcli from source, follow these steps:
-
Clone the repository:
Open a terminal window and run the following command:
git clone https://github.com/MrBanja/gcli.git
This will create a new directory named "gcli" in your current path.
-
Navigate into the directory:
Use the
cd
command to enter into the directory:cd gcli
-
Build the application:
Run the following command to compile the project.
go build
This will create an executable file named "gcli".
-
Install application:
To install the gcli on your system run the following command
go install
Congratulations, you have installed gcli
from source on your system. To verify the installation; try executing gcli
. If the installation is successful you should be able to see usage options for gcli command.
The project utilizes the following open-source libraries:
- glamour: A library for rendering Markdown.
- screen: A library for clearing the console.
- cobra: A CLI framework for Go.
- viper: A library for configuration management.
- openaiAPI: A library for querying the OpenAI API.
Before using gcli, you need to obtain an OpenAI API token from https://platform.openai.com/account/api-keys. Once you have the token, set it using the following command:
gcli config set openai.token sk-xxx
Here are the available commands and their usage:
Ask ChatGPT a question or provide an input query. Example usage:
gcli "What is the capital of France?"
Command for working with conversations. Available sub-commands:
gcli conv del
: Delete the current conversation.gcli conv history
: Command for working with the current conversation history.gcli conv ls
: Display all conversations.gcli conv use
: Use a conversation with the given ID. If the conversation does not exist, it will be created.
Set configuration options. Available sub-commands:
gcli config set
: Set configuration values.
Display current version.
Command for working with the current conversation history. Available sub-commands:
gcli conv history all
: Show all messages in the conversation.gcli conv history clear
: Clear the current conversation history.gcli conv history last
: Show the last message of the current conversation.
For more information about each command and their flags, you can use the -h
or --help
flag with the respective command.
This project is licensed under the MIT License. See the LICENSE file for more information.