Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Command Master

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.


Features

  • 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.

Prerequisites

  • 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.

Installation

  1. Clone the repository:
git clone https://github.com/your-username/command-master.git
cd command-master
  1. Configure your OpenAI API Key:
    • Create a .env file in the project's root directory and add your API key:
OPENAI_API_KEY=your_openai_api_key
  1. Build the project:
cargo build
  1. Run the project:
cargo run

Usage

  1. The program will randomly select a Linux command.
  2. It will display a concise explanation of the command, generated by OpenAI's API.
  3. A small exercise will be suggested to help you practice the command.
  4. In the future, commands marked as interesting will be saved and managed based on priority, using a max heap for efficient retrieval.

Example Output

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

Future Features

  • 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.

Testing

The project includes tests to ensure the core functionalities work as expected. Run the tests using:

cargo test

Project Structure

  • src/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).

Contribution

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.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

Special thanks to OpenAI for their powerful API and the Rust community for creating such an amazing language!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages