lc
is a professional Linux command-line assistant designed to help users answer questions about Linux commands, operations, and problems. It supports OpenAI-formatted LLM requests, provides concise and clear command-line answers, and supports a rich set of configuration options.
- Instant Query: Query Linux command-related questions directly through the command line.
- Conversation Memory: Optionally enable conversation memory to save historical conversations for subsequent queries.
- Configuration Management: Supports setting and saving OpenAI API keys, models, history length, and other configurations.
- Debug Mode: Provides a debug mode that outputs detailed request and response information for easy debugging.
Use the following command to compile and install lc
:
make install
Use the following command to uninstall lc
:
make uninstall
lc -q "How do I use the ls command to list all files?"
lc -q "How do I use the grep command?" -m
lc --clear-memory
lc --set openai_api_key=YOUR_API_KEY
lc -q "How do I use the find command?" --debug
The configuration file is located at ~/.config/lc/config.yaml
and contains the following configuration items:
Configuration Item | Description |
---|---|
openai_api_key |
OpenAI API Key |
openai_base_url |
OpenAI API Base URL |
default_model |
Default GPT Model |
system_prompt |
System Prompt |
max_history |
Maximum History Length |
Target | Description |
---|---|
all |
Default target, equivalent to build |
build |
Compile the project |
install |
Install the compiled program to /usr/local/bin |
uninstall |
Uninstall the program |
clean |
Clean up compiled files |
help |
Display help information |
config.rs
: Handles loading and saving the configuration file.main.rs
: Main program entry point, handles command-line arguments and logic.openai.rs
: Interaction logic with the OpenAI API.
lc -q "How do I use the tar command to extract files?"
lc -q "How do I use the awk command to process text?" -m
lc --set openai_api_key=YOUR_API_KEY
We welcome Issues and Pull Requests to contribute code and improve documentation. We look forward to your participation!
We hope this README helps you better use and understand the lc
project! If you have any questions or suggestions, please feel free to provide feedback.