GithubHelp home page GithubHelp logo

esmaeelnabil / hto Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 6.77 MB

The Terminal Expert CLI tool, use openAI api to help you with terminal commands

Shell 8.26% JavaScript 91.74%
ai cli cli-app openai terminal-app

hto's Introduction

image

This script helps users query terminal command syntax, interactively decide actions, and even execute terminal commands directly. It leverages OpenAI's GPT model to provide accurate and quick command suggestions.

Features

  • Query terminal commands based on natural language input.
  • Interactive mode to choose actions like copying commands to clipboard.
  • Option to execute commands directly.
  • Debug mode for more detailed output.

Installation

  1. Clone the repository:

    git clone https://github.com/EsmaeelNabil/hto
    cd hto
  2. Install dependencies:

    bun install
  3. Add your OpenAI API Key:

    • Create a .env file in the root directory of your project in case of development.
    • Or Add it in your .zshrc or .bashrc or even export API_KEY=your_api_key_here in your terminal before running the script.
    • To Add your API Key:
      API_KEY=your_api_key_here
  4. generate an executable:

    • To generate hto in your project directory, run the following command:
      ./release.sh

Usage

Basic Usage

To query terminal commands using natural language input:

./hto "How to list files in macOS"

Interactive Mode

image

For an interactive session where you can choose actions such as copying commands to the clipboard:

./hto -i

Follow the prompts to input your question and select the desired action.

Execute Mode

To execute the terminal command suggested by the script: image

./hto -e "How to list files in macOS"

Debug Mode

For additional debug information: image

./hto -d "How to list files in macOS"

Use specific Model

To use a specific model, use the -m key.

image
./hto "How to list directories in Linux" -m "gpt-4o" -d

Development Mode

If you want to try the script in development mode, use bun run main.js instead of hto:

bun run main.js "How to list files in macOS"

Contribution

Feel free to fork the project, open issues, or submit pull requests to improve this project.

License

This project is licensed under the MIT License.

Releases

You can find the latest release here.

hto's People

Contributors

esmaeelnabil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.