This Python script is an interactive command-line tool that generates Linux or Windows commands based on user input. It leverages OpenAI's GPT model (gpt-4o-mini) to generate shell commands and provides an option to execute them directly from the terminal.
- π₯οΈ Detects the userβs operating system (Linux/macOS or Windows).
- π€ Uses OpenAI's API to generate a command based on a natural language description.
- π Displays the generated command for user approval.
- β‘ Allows users to execute the command directly from the terminal.
python CommandGenerator
1 # For Linux/macOS
2 # For Windows
Please describe the command you want: list all files in the current directory
ls -l
Do you want to run the command? (yes/no):
β’ π Always review the generated command before executing it, as AI-generated commands might be incorrect or harmful.
β’ β This script does not validate the commandβs safety before execution. Use with caution.
β’ π Running AI-generated commands as root/admin can be dangerous.