OpenWeather CLI Skill
Instruction-only skill document for using and troubleshooting owget (OpenWeather CLI).
Skill Purpose and Trigger Scenarios
- - The user wants current weather, forecast, or geocoding (
geo) results. - The user asks how to run
owget commands or use parameters. - The user reports API key issues, HTTP errors, or city lookup failures.
Install from GitHub
- - GitHub: https://github.com/ParinLL/OpenWeatherMap-script
Recommended install:
CODEBLOCK0
This installs owget into your Go bin directory (for example, $GOPATH/bin or $HOME/go/bin).
Required Environment Variables / Permissions
Required environment variable:
CODEBLOCK1
- - Requires the
go toolchain for build/install. - System-wide installation into protected directories (for example,
/usr/local/bin) requires admin privileges and prior source review. - Never expose full API keys in outputs; debug request logs should redact credential query params (for example,
appid).
How to Use the Binary
After installation, make sure owget is available in your shell:
CODEBLOCK2
If your shell cannot find it, add your Go bin path to PATH:
CODEBLOCK3
Core command patterns:
- - Current weather by coordinates:
-
owget weather <lat> <lon>
- Example:
owget weather 25.0330 121.5654
- - Current weather by city:
-
owget city "<City,Country>"
- Example:
owget city "Taipei,TW"
-
owget forecast <lat> <lon>
- Example:
owget forecast 25.0330 121.5654
- - 5-day forecast by city:
-
owget city "<City,Country>" forecast
- Example:
owget city "Taipei,TW" forecast
-
owget geo "<query>"
- Example: INLINECODE20
Useful flags:
- -
--detail: show extended fields (for example pressure, wind, sunrise/sunset, visibility). - INLINECODE22 : print HTTP debug information for troubleshooting. Sensitive query parameters are redacted.
Common usage flow:
- 1. Export
OPENWEATHER_API_KEY. - Run
owget geo "<City,Country>" if you need to verify location naming. - Use
owget weather ... or owget forecast ... for actual weather data. - Add
--detail for richer output, and --debug only when troubleshooting.
Common Troubleshooting
- The env var is not set. Run
export OPENWEATHER_API_KEY="..." first.
- - API returns INLINECODE31
- API key is invalid, expired, or mistyped. Re-check your OpenWeatherMap key.
- - API returns
404 or city not found
- Use
City,Country format (for example,
Taipei,TW) and verify with
owget geo "<query>" first.
- - Concern about credential leakage while using debug mode
- Debug request URLs are redacted for sensitive params, but avoid long-running debug in shared/logged environments.
OpenWeather CLI 技能
用于使用和排查 owget(OpenWeather CLI)的纯指令技能文档。
技能目的与触发场景
- - 用户需要当前天气、预报或地理编码(geo)结果。
- 用户询问如何运行 owget 命令或使用参数。
- 用户报告 API 密钥问题、HTTP 错误或城市查找失败。
从 GitHub 安装
- - GitHub:https://github.com/ParinLL/OpenWeatherMap-script
推荐安装方式:
bash
git clone https://github.com/ParinLL/OpenWeatherMap-script.git
cd OpenWeatherMap-script
go install .
这会将 owget 安装到您的 Go bin 目录(例如 $GOPATH/bin 或 $HOME/go/bin)。
所需环境变量/权限
必需的环境变量:
bash
export OPENWEATHERAPIKEY=your-api-key
- - 需要 go 工具链进行构建/安装。
- 系统级安装到受保护目录(例如 /usr/local/bin)需要管理员权限并事先审查源代码。
- 切勿在输出中暴露完整的 API 密钥;调试请求日志应隐去凭证查询参数(例如 appid)。
如何使用二进制文件
安装后,确保 owget 在您的 shell 中可用:
bash
owget --help
如果您的 shell 找不到它,请将 Go bin 路径添加到 PATH:
bash
export PATH=$PATH:$(go env GOPATH)/bin
核心命令模式:
- owget weather
- 示例:owget weather 25.0330 121.5654
- owget city
- 示例:owget city Taipei,TW
- owget forecast
- 示例:owget forecast 25.0330 121.5654
- owget city forecast
- 示例:owget city Taipei,TW forecast
- owget geo
- 示例:owget geo New York,US
有用的标志:
- - --detail:显示扩展字段(例如气压、风向、日出/日落、能见度)。
- --debug:打印 HTTP 调试信息以进行故障排查。敏感查询参数会被隐去。
常见使用流程:
- 1. 导出 OPENWEATHERAPIKEY。
- 如果需要验证位置命名,运行 owget geo 。
- 使用 owget weather ... 或 owget forecast ... 获取实际天气数据。
- 添加 --detail 获取更丰富的输出,仅在故障排查时使用 --debug。
常见故障排查
- - error: OPENWEATHERAPIKEY env is required
- 环境变量未设置。先运行 export OPENWEATHERAPIKEY=...。
- API 密钥无效、已过期或输入错误。重新检查您的 OpenWeatherMap 密钥。
- 使用 City,Country 格式(例如 Taipei,TW),并先用 owget geo 验证。
- 调试请求 URL 中的敏感参数会被隐去,但避免在共享/记录环境中长时间运行调试模式。