#gpt #gpt3 #cli #url #syntax-highlight #file-formats

bin+lib a-gpt

a CLI tool to generate and pretty-print code snippets from ChatGPT

25 releases

0.3.2 Mar 18, 2023
0.3.1 Mar 12, 2023
0.2.8 Mar 7, 2023
0.1.14 Mar 4, 2023

#673 in Development tools

Download history 285/week @ 2023-02-25 268/week @ 2023-03-04 80/week @ 2023-03-11 34/week @ 2023-03-18 28/week @ 2023-03-25 57/week @ 2023-04-01 160/week @ 2023-04-08 57/week @ 2023-04-15 29/week @ 2023-04-22 4/week @ 2023-04-29 83/week @ 2023-05-06 9/week @ 2023-05-13 16/week @ 2023-05-20

112 downloads per month

MIT and LGPL-3.0-or-later

196 lines


CLI tool to generate code from ChatGPT that pretty-prints the output by language



cargo install a-gpt

# or to enable clipboard functionality:
# cargo install a-gpt --features clipboard

export OPENAI_API_KEY=sk-WEz... # from https://platform.openai.com/account/api-keys

For local development:

make release
sudo make install

If the clipboard feature is enabled and you are running Ubuntu/Debian, you may need to install the following packages:

sudo apt install xorg-dev libxcb-composite0-dev xclip


You will need an OpenAI API key, and to set the environment variable OPENAI_API_KEY.

Invoke the a command followed by a prompt. If the first word in the prompt is a programming language or file-format the pretty-printer recognizes, it will syntax highlight the output.

a python script that fetches a url
a rust program that showcases its various features
a yaml manifest describing a kubernetes deployment

Invoking the command with no arguments will read from stdin, accepting input interactively or from a pipe. You can choose to include or not include the word "a" at the beginning your input string.

echo "python script that fetches a url" | a
echo "a python script that fetches a url" | a

If installed with the clipboard feature enabled, the output will be copied to the clipboard.


~409K SLoC