Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

htu — 命令行工具用法查询助手

How To Use — 输入命令名,AI 告诉你用法。

查询 Linux 命令的用法(tar, find, git, docker 等),调用本地 Ollama 模型流式输出答案,支持联网搜索增强。

快速开始

# 1. 安装依赖
pip install -r requirements.txt

# 2. 确保 Ollama 正在运行
systemctl --user start ollama

# 3. 使用
python htu.py tar

用法

python htu.py <命令> [选项]

参数

参数 说明
query 要查询的命令(必填)

选项

选项 默认值 说明
-n, --no-search 禁用联网搜索,仅用模型知识
-m, --model codellama:7b Ollama 模型名
--ollama-url http://localhost:11434 Ollama 服务地址

示例

# 查询 tar 命令用法(联网搜索增强)
python htu.py tar

# 查询带空格的命令
python htu.py "git commit"

# 仅用模型知识,不联网
python htu.py curl -n

# 指定模型
python htu.py find -m llama3.2:3b

# 使用远程 Ollama
python htu.py docker --ollama-url http://192.168.1.100:11434

设为系统命令

将脚本设为可执行并加到 PATH 中:

chmod +x htu.py

# 方法 A: 软链到 ~/.local/bin(推荐)
ln -s "$(pwd)/htu.py" ~/.local/bin/htu

# 方法 B: shell alias(加到 ~/.bashrc)
echo "alias htu='python3 $(pwd)/htu.py'" >> ~/.bashrc
source ~/.bashrc

之后直接用:

htu tar

依赖

  • Python 3.8+
  • requests
  • 本地运行的 Ollama(带可用模型如 qwen3:8b

项目结构

qwenconnent/
├── htu.py              # 主脚本
├── requirements.txt     # Python 依赖
├── .gitignore
└── README.md

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages