Skip to content

gabrielheider/terminalhelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TerminalHelper

TerminalHelper is an intuitive tool designed to harness the power of ChatGPT, allowing you to convert natural language inquiries into terminal commands. No longer do you need to memorize commands or look them up online; just ask TerminalHelper in plain English!

TerminalHelper Logo

Table of Contents

Features

  • Convert natural language input into useful cmd/terminal commands.
  • On windows it is possible to include the visible part of the cmd to the question

Prerequisites

  • A modern C++ compiler with support for C++17.
  • CMake (version 3.11 or higher, due to the use of FetchContent).
  • OpenAI API-Key.
  • Internet connection to interact with ChatGPT.
  • cpr library for making HTTP requests (automatically fetched during CMake build).
  • nlohmann JSON library for handling JSON data.

Installation

Clone the Repository:

git clone https://github.com/gabrielheider/terminalhelper.git
cd terminalhelper

Install nlohman if you have vcpkg (on windows) do: vcpkg install nlohmann-json:x64-windows

Build from Source using CMake:

mkdir build && cd build
cmake ..
make

Usage

Windows:

Start TerminalHelper by running:

terminalhelper.exe

On Windows, you can provide an -c argument to provide a specific context from the terminal:

terminalhelper.exe -c

Linux:

On Linux, use the provided bash script run_helper.sh to start the program. This script will also manipulate the terminal command history so that the generated commands are appended:

./run_helper.sh

Bash Script Content (run_helper.sh):

#!/bin/bash

# Run the helper and capture the commands
COMMANDS=$(/home/adminlokal/projekte/terminalhelper/build/TerminalHelper | tee /dev/tty)

# Add each command to the shell's history
IFS=$'\n' # Use newline as the delimiter
for cmd in $COMMANDS; do
    history -s "$cmd"
done

echo "Commands have been added to history. Use up/down arrow keys."

Once started, you'll be prompted to enter your natural language query. For instance:

> How do I list all files in a directory?

TerminalHelper will then provide the respective command:

ls -l

Contributing

We welcome contributions! Please follow the standard GitHub pull request process.

License

This project is licensed under the MIT License.

Acknowledgements

  • Thanks to OpenAI for the incredible ChatGPT model.
  • Shoutout to the cpr library for HTTP request functionality and nlohmann JSON library for JSON parsing.
  • All contributors and testers who made TerminalHelper possible.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published