diff --git a/README.md b/README.md index 39c7b60..1982db8 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ Run `opencli list` for the live registry. | **bloomberg** | `main` `markets` `economics` `industries` `tech` `politics` `businessweek` `opinions` `feeds` `news` | Public / Browser | | **ctrip** | `search` | Browser | | **devto** | `top` `tag` `user` | Public | +| **weather** | `search` | Public | | **arxiv** | `search` `paper` | Public | | **wikipedia** | `search` `summary` | Public | | **hackernews** | `top` | Public | diff --git a/README.zh-CN.md b/README.zh-CN.md index 7fb4f73..cd17259 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -143,6 +143,7 @@ npm install -g @jackwener/opencli@latest | **bloomberg** | `main` `markets` `economics` `industries` `tech` `politics` `businessweek` `opinions` `feeds` `news` | 公共 API / 浏览器 | | **ctrip** | `search` | 浏览器 | | **devto** | `top` `tag` `user` | 公开 | +| **weather** | `search` | 公开 | | **arxiv** | `search` `paper` | 公开 | | **wikipedia** | `search` `summary` | 公开 | | **hackernews** | `top` | 公共 API | diff --git a/docs/adapters/browser/weather.md b/docs/adapters/browser/weather.md new file mode 100644 index 0000000..9571cb3 --- /dev/null +++ b/docs/adapters/browser/weather.md @@ -0,0 +1,25 @@ +# Weather + +**Mode**: 🌐 Public · **Domain**: `wttr.in` + +Fetch instant live weather globally from any city directly within your terminal window. + +## Commands + +| Command | Description | +|---------|-------------| +| `opencli weather search` | Get the current weather conditions for any location | + +## Usage Examples + +```bash +# Get the weather in London right now +opencli weather search --location "London" + +# Get the weather in New York +opencli weather search --location "New York" +``` + +## Prerequisites + +- No browser required — uses the fast, public `wttr.in` API. diff --git a/docs/adapters/index.md b/docs/adapters/index.md index 247ca5d..d5d76a2 100644 --- a/docs/adapters/index.md +++ b/docs/adapters/index.md @@ -44,6 +44,7 @@ Run `opencli list` for the live registry. | **[hf](/adapters/browser/hf)** | `top` | 🌐 Public | | **[sinafinance](/adapters/browser/sinafinance)** | `news` | 🌐 Public | | **[stackoverflow](/adapters/browser/stackoverflow)** | `hot` `search` `bounties` `unanswered` | 🌐 Public | +| **[weather](/adapters/browser/weather)** | `search` | 🌐 Public | | **[wikipedia](/adapters/browser/wikipedia)** | `search` `summary` | 🌐 Public | ## Desktop Adapters diff --git a/src/clis/weather/search.yaml b/src/clis/weather/search.yaml new file mode 100644 index 0000000..c6e4c25 --- /dev/null +++ b/src/clis/weather/search.yaml @@ -0,0 +1,27 @@ +site: weather +name: search +description: Search for live weather telemetry of any global city +domain: wttr.in +strategy: public +browser: false + +args: + location: + type: string + required: true + description: City name or zip code to search for (e.g. Paris, 10001) + +pipeline: + - fetch: + url: "https://wttr.in/${{ args.location }}?format=j1" + + - select: current_condition + + - map: + condition: "${{ item.weatherDesc[0].value }}" + temp: "${{ item.temp_C }}°C" + feels: "${{ item.FeelsLikeC }}°C" + humidity: "${{ item.humidity }}%" + wind: "${{ item.windspeedKmph }} km/h" + +columns: [condition, temp, feels, humidity, wind]