Command Master is a Rust project designed to help users learn and explore Linux commands in a fun and interactive way. The program randomly selects a Linux command, provides a concise explanation of its usage, and suggests a small exercise to practice with it.
The project uses OpenAI's API to generate clear and tailored explanations for the selected commands. In future updates, the program will include a feature to save interesting commands and recall them periodically based on a priority system. A max heap is planned to efficiently manage saved commands by their priority.
- Random Linux Command Selection: A random command is selected and explained to the user.
- AI-Generated Explanations: OpenAI's API generates concise explanations and practical exercises for the command.
- Planned Features:
- Saving Commands with Priority: Interesting commands will be saved and managed based on a priority system (1 to 7). Commands with higher priorities will be recalled more frequently.
- Max Heap for Priority Management: A max heap data structure will likely be implemented to manage and efficiently retrieve commands with the highest priority.
- Rust: Make sure you have Rust installed (stable version recommended).
- OpenAI API Key: An API key is required to use the AI generation features. Obtain your key from OpenAI.
- Clone the repository:
git clone https://github.com/your-username/command-master.git
cd command-master- Configure your OpenAI API Key:
- Create a
.envfile in the project's root directory and add your API key:
- Create a
OPENAI_API_KEY=your_openai_api_key- Build the project:
cargo build- Run the project:
cargo run- The program will randomly select a Linux command.
- It will display a concise explanation of the command, generated by OpenAI's API.
- A small exercise will be suggested to help you practice the command.
- In the future, commands marked as interesting will be saved and managed based on priority, using a max heap for efficient retrieval.
Selected Command: ls
Description:
The `ls` command lists the files and directories in a folder.
Exercise:
List all the files in a directory, including hidden ones, sorted by size in descending order.
Possible Solution:
ls -laS
- Saving Commands:
- Add a feature to save interesting commands with a priority level (1 to 7) for periodic reminders.
- Max Heap for Priority Management: A max heap will likely be used to prioritize saved commands, ensuring that higher-priority commands are retrieved and displayed first.
- Export Functionality:
- Save interesting commands to a JSON or CSV file for external usage.
- Command Scheduling:
- Automatic reminders for saved commands based on user-configured schedules.
The project includes tests to ensure the core functionalities work as expected. Run the tests using:
cargo testsrc/main.rs: The program's entry point.src/ia/: Module handling OpenAI API interactions.chat.rs: Manages requests and responses with OpenAI.- Future Modules: Planned implementation for saving and recalling commands with priority (likely using a max heap).
Contributions are welcome! If you'd like to suggest a new feature or fix a bug, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Special thanks to OpenAI for their powerful API and the Rust community for creating such an amazing language!