Ask ChatGPT for a shell script, code, or anything, directly from your terminal πŸ€–πŸ§ πŸ‘¨β€πŸ’»

Overview


ShellGPT


Ask ChatGPT for a shell script, code, or anything, directly from your terminal πŸ€– 🧠 πŸ‘¨β€πŸ’»

Cargo Build and Test Downloads Downloads

Demo

Demo video

Install

The binary is named gpt when installed, not shell-gpt.

Cargo

cargo install shell-gpt
gpt --help

From source

git clone [email protected]:rigwild/shell-gpt-rs.git
cd shell-gpt-rs
cargo install --path .

Usage

On first usage, ShellGPT will prompt you to enter your OpenAI API key.

This key will then be saved to ~/.config/shell-gpt-rs, encrypted with ChaCha20-Poly1305, to be reused later.

Any question

Ask any question to ChatGPT.

gpt <any question>

--script

Ask ChatGPT to create a script, then run it if you want to. A pre-prompt will be included with your request.

gpt --shell show me the 10 biggest files in the current tree
Asking ChatGPT...

#!/bin/bash
du -ah | sort -rh | head -n 10

Do you want to run this script? (y/N) y

Executing script...

--------------


4.1G    ./target
4.1G    .
3.5G    ./target/debug
2.9G    ./target/debug/deps
588M    ./target/release
488M    ./target/release/deps
387M    ./target/debug/build
241M    ./target/debug/incremental
98M     ./target/release/build
86M     ./target/debug/deps/gpt-54b56efa1b0d0573

--raw

Ask ChatGPT to create a script, but do not show a loading spinner or interactive prompt, does not run the script.

This can be used to pipe the script to another command.

gpt --shell --raw show me the 10 biggest files in the current tree
du -ah | sort -rh | head -n 10

--clear-config

Remove local config, including the OpenAI API key at ~/.config/shell-gpt-rs.

gpt --clear-config

Help message

gpt --help
Ask ChatGPT for a shell script, code, or anything, directly from your terminal πŸ€–πŸ§ πŸ‘¨β€πŸ’»

Usage: gpt <your_question>

Options:
  -s  --shell           Ask ChatGPT for a shell script                                                  [boolean=false]
      --raw             Only output the script, no spinner or interactive prompt                        [boolean=false]
      --clear-config    Remove local config, including the OpenAI API key at `~/.config/shell-gpt-rs`   [boolean]
  -h, --help            Show help                                                                       [boolean]

Examples:
  gpt is the earth flat?
  gpt --shell show the list of files in the current directory with human-readable file size
  gpt -s find the top 10 biggest files in the current directory
  gpt -s find the top 10 biggest files in the current tree recursive
  gpt --raw --shell find the top 10 biggest files in the current tree recursive
  gpt --raw --shell find the top 10 biggest files in the current tree recursive > 10_biggest_files.sh
  gpt --raw tell me a good joke | curl -X POST -d @- https://example.com/api/jokes

shell-gpt-rs - https://github.com/rigwild/shell-gpt-rs

Examples

gpt How to install a package in Arch Linux?
gpt How to create a Rust crate?
gpt --shell show the list of files in the current directory with human-readable file size
gpt -s find the top 10 biggest files in the current tree recursive

# Save the script to a file
gpt --raw --shell find the top 10 biggest files in the current tree recursive > 10_biggest_files.sh

# Generate a joke then post it with curl
gpt --raw tell me a good joke | curl -X POST -d @- https://example.com/api/jokes

License

The MIT license

You might also like...
[WIP] Store bookmarks to anything

Handyman - store bookmarks to anything Handyman Acronym's Noticeably Dumb, Yet Makes A Name The motivation Internet browsers have bookmarks. File mana

Replace an app's icon from a png with a single terminal script. Made with Rust

Replace macOS App Icon Replace an app's icon from a png with a single terminal CLI. Made with Rust

An elegant language for script-kiddies and terminal squatters.

Tonic An elegant language for script-kiddies and terminal squatters. About I started Tonic to complete the Advent of Code 2021. My eventual goal is to

❗️ Small script to view GitHub notifications in the terminal
❗️ Small script to view GitHub notifications in the terminal

github-notifications Small script to view GitHub notifications in the terminal Shows and color-codes the notification source, eg if you're the owner o

Raw C Shell: interact with your operating system using raw C code, because why not?
Raw C Shell: interact with your operating system using raw C code, because why not?

rcsh Raw C Shell is a minimalist shell with no built in commands. You write entirely in C code and use return; to execute your code. Unlike that silly

A simple code that will load a shellcode directly into RAM memory in a new process
A simple code that will load a shellcode directly into RAM memory in a new process

γ€Œ πŸ”„ 」About RustSCLoader RustSCLoader is a simple code that has the intention of loading a shellcode directly into RAM memory in a new process that wi

ChatGPT CLI - A minimal assistant in the terminal
ChatGPT CLI - A minimal assistant in the terminal

ChatGPT CLI A lightweight ChatGPT CLI - Chat completion. Interact with ChatGPT from your terminal and save the conversation in a text file. Get starte

Using ChatGPT/GPT-3.5/GPT-4 in the terminal.
Using ChatGPT/GPT-3.5/GPT-4 in the terminal.

AIChat Using ChatGPT/GPT-3.5/GPT-4 in the terminal. AIChat in chat mode: AIChat in command mode: Install With cargo cargo install --force aichat Bina

🐒 Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands
🐒 Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands

Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands. Additionally, it provides optional and fully encrypted synchronisation of your history between machines, via an Atuin server.

Owner
blockchain cutie
null
Animated app icons in your Dock that can run an arbitrary shell script when clicked.

Live App Icon for Mac Animated app icons in your Dock that can run an arbitrary shell script when clicked. Requirements macOS 13 (Ventura) or higher X

Daichi Fujita 13 Jun 8, 2023
Not the fastest terminal colors library. Don't even ask about size.

TROLOLORS Not the fastest terminal colors library. Don't even ask about size. Why? Don't even try to use it. But maybe you need to say to your boss th

Dmitriy Kovalenko 15 Oct 27, 2021
A terminal ASCII media player. View images, gifs, videos, webcam, YouTube, etc.. directly in the terminal as ASCII art.

Terminal Media Player View images, videos (files or YouTube links), webcam, etc directly in the terminal as ASCII. All images you see below are just m

Max Curzi 36 May 8, 2023
ChatGPT-rs is a lightweight ChatGPT client with a graphical user interface, written in Rust

ChatGPT-rs is a lightweight ChatGPT client with a graphical user interface, written in Rust. It allows you to chat with OpenAI's GPT models through a simple and intuitive interface.

null 7 Apr 2, 2023
A CLI tool you can pipe code and then ask for changes, add documentation, etc, using the OpenAI API.

AiBro This is your own little coding bro, immersed in the world of AI, crypto, and all other types of over hyped tech trends. You can pipe it code and

Josh Bainbridge 5 Sep 5, 2023
A Rust-based shell script to create a folder structure to use for a single class every semester. Mostly an excuse to use Rust.

A Rust Course Folder Shell Script PROJECT IN PROGRESS (Spring 2022) When completed, script will create a folder structure of the following schema: [ro

SebastiΓ‘n Romero Cruz 1 Apr 10, 2022
Save image from your clipboard πŸ“‹ as an image file directly from your command line! πŸ”₯

Clpy ?? Save copied image from clipboard as an image file directly from your command line! Note It works only on windows as of now. I'll be adding sup

Piyush Suthar 13 Nov 28, 2022
ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code

ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code. It accepts a local path to a folder containing code, and generates a review for each file in the folder and its subdirectories.

Greg P. 15 Apr 22, 2023
Donate To Charity (A.K.A. Public Goods) Without Lossing Anything

Donate To Charity (A.K.A. Public Goods) Without Lossing Anything

Gajesh Naik 10 Mar 3, 2022
Extend anything with WebAssembly.

Welcome! Please note: this project still under active development. It's usable, but expect some rough edges while work is underway. If you're interest

Extism 1.5k Jan 3, 2023