|
6 | 6 |
|
7 | 7 | | Command | Description | |
8 | 8 | |---------|-------------| |
9 | | -| `opencli linux-do hot` | 热门话题 | |
10 | | -| `opencli linux-do latest` | 最新话题 | |
11 | | -| `opencli linux-do categories` | 板块列表 | |
12 | | -| `opencli linux-do category` | 板块话题 | |
13 | | -| `opencli linux-do search` | 搜索话题 | |
14 | | -| `opencli linux-do topic` | 话题详情 | |
| 9 | +| `opencli linux-do feed` | Browse topics (site-wide, by tag, or by category) | |
| 10 | +| `opencli linux-do categories` | List all categories | |
| 11 | +| `opencli linux-do tags` | List popular tags | |
| 12 | +| `opencli linux-do search <query>` | Search topics | |
| 13 | +| `opencli linux-do topic <id>` | View topic posts | |
| 14 | +| `opencli linux-do user-topics <username>` | Topics created by a user | |
| 15 | +| `opencli linux-do user-posts <username>` | Replies posted by a user | |
15 | 16 |
|
16 | | -## Usage Examples |
| 17 | +## feed |
| 18 | + |
| 19 | +Browse topic listings. Defaults to latest topics when called with no arguments. |
| 20 | + |
| 21 | +- Supports filtering by `--tag`, `--category`, or both |
| 22 | +- `--tag` accepts tag name, slug, or ID |
| 23 | +- `--category` accepts category name, slug, ID, or `Parent / Child` path for sub-categories |
| 24 | +- Use `--view` to switch between latest / hot / top |
| 25 | + |
| 26 | +### Basic |
17 | 27 |
|
18 | 28 | ```bash |
19 | | -# Hot topics this week |
20 | | -opencli linux-do hot --limit 20 |
| 29 | +# Latest topics (default) |
| 30 | +opencli linux-do feed |
| 31 | + |
| 32 | +# Hot topics |
| 33 | +opencli linux-do feed --view hot |
| 34 | + |
| 35 | +# Top topics — default period is weekly |
| 36 | +opencli linux-do feed --view top |
| 37 | +opencli linux-do feed --view top --period daily |
| 38 | +opencli linux-do feed --view top --period monthly |
21 | 39 |
|
22 | | -# Hot topics by period |
23 | | -opencli linux-do hot --period daily |
24 | | -opencli linux-do hot --period monthly |
| 40 | +# Sort by views descending |
| 41 | +opencli linux-do feed --order views |
| 42 | + |
| 43 | +# Sort by created time ascending |
| 44 | +opencli linux-do feed --order created --ascending |
| 45 | + |
| 46 | +# Limit results |
| 47 | +opencli linux-do feed --limit 10 |
| 48 | + |
| 49 | +# JSON output |
| 50 | +opencli linux-do feed -f json |
| 51 | +``` |
25 | 52 |
|
26 | | -# Latest topics |
27 | | -opencli linux-do latest --limit 10 |
| 53 | +### Filter by tag |
| 54 | + |
| 55 | +```bash |
| 56 | +# By tag name, slug, or ID — all equivalent |
| 57 | +opencli linux-do feed --tag "ChatGPT" |
| 58 | +opencli linux-do feed --tag chatgpt |
| 59 | +opencli linux-do feed --tag 3 |
| 60 | + |
| 61 | +# Tag + hot view |
| 62 | +opencli linux-do feed --tag "ChatGPT" --view hot |
| 63 | + |
| 64 | +# Tag + top view with period |
| 65 | +opencli linux-do feed --tag "OpenAI" --view top --period monthly |
| 66 | +``` |
| 67 | + |
| 68 | +### Filter by category |
| 69 | + |
| 70 | +Supports both top-level and sub-categories. Sub-categories auto-resolve their parent path. |
| 71 | + |
| 72 | +```bash |
| 73 | +# Top-level category — name, slug, or ID |
| 74 | +opencli linux-do feed --category "开发调优" |
| 75 | +opencli linux-do feed --category develop |
| 76 | +opencli linux-do feed --category 4 |
28 | 77 |
|
29 | | -# List all categories |
| 78 | +# Sub-category |
| 79 | +opencli linux-do feed --category "开发调优 / Lv1" |
| 80 | +opencli linux-do feed --category "网盘资源" |
| 81 | + |
| 82 | +# Category + hot / top view |
| 83 | +opencli linux-do feed --category "开发调优" --view hot |
| 84 | +opencli linux-do feed --category "开发调优" --view top --period weekly |
| 85 | +``` |
| 86 | + |
| 87 | +### Category + tag |
| 88 | + |
| 89 | +Combine `--category` and `--tag` to narrow results within a category. |
| 90 | + |
| 91 | +```bash |
| 92 | +opencli linux-do feed --category "开发调优" --tag "ChatGPT" |
| 93 | +opencli linux-do feed --category "网盘资源" --tag "OpenAI" |
| 94 | +opencli linux-do feed --category 94 --tag 4 --view top --period monthly |
| 95 | +``` |
| 96 | + |
| 97 | +### Parameters |
| 98 | + |
| 99 | +| Parameter | Description | Default | |
| 100 | +|-----------|-------------|---------| |
| 101 | +| `--view V` | `latest`, `hot`, `top` | `latest` | |
| 102 | +| `--tag VALUE` | Tag name, slug, or ID | — | |
| 103 | +| `--category VALUE` | Category name, slug, or ID | — | |
| 104 | +| `--limit N` | Number of results | `20` | |
| 105 | +| `--order O` | `default`, `created`, `activity`, `views`, `posts`, `category`, `likes`, `op_likes`, `posters` | `default` | |
| 106 | +| `--ascending` | Sort ascending instead of descending | off | |
| 107 | +| `--period P` | `all`, `daily`, `weekly`, `monthly`, `quarterly`, `yearly` (only with `--view top`) | `weekly` | |
| 108 | + |
| 109 | +Output columns: `title`, `replies`, `created`, `likes`, `views`, `url` |
| 110 | + |
| 111 | +## categories |
| 112 | + |
| 113 | +List forum categories with optional sub-category expansion. |
| 114 | + |
| 115 | +```bash |
30 | 116 | opencli linux-do categories |
| 117 | +opencli linux-do categories --subcategories |
| 118 | +opencli linux-do categories --limit 50 |
| 119 | +``` |
| 120 | + |
| 121 | +When `--subcategories` is enabled, sub-categories are rendered as `Parent / Child` so the `name` value can be copied directly into `opencli linux-do feed --category ...`. |
| 122 | + |
| 123 | +Output columns: `name`, `slug`, `id`, `topics`, `description` |
| 124 | + |
| 125 | +## tags |
31 | 126 |
|
32 | | -# Search topics |
| 127 | +List tags sorted by usage count. |
| 128 | + |
| 129 | +```bash |
| 130 | +opencli linux-do tags |
| 131 | +opencli linux-do tags --limit 50 |
| 132 | +``` |
| 133 | + |
| 134 | +Output columns: `rank`, `name`, `count`, `url` |
| 135 | + |
| 136 | +## search |
| 137 | + |
| 138 | +Search topics by keyword. |
| 139 | + |
| 140 | +```bash |
33 | 141 | opencli linux-do search "NixOS" |
| 142 | +opencli linux-do search "Docker" --limit 10 |
| 143 | +opencli linux-do search "Claude" -f json |
| 144 | +``` |
34 | 145 |
|
35 | | -# View topic details |
36 | | -opencli linux-do topic 12345 |
| 146 | +Output columns: `rank`, `title`, `views`, `likes`, `replies`, `url` |
37 | 147 |
|
38 | | -# JSON output |
39 | | -opencli linux-do hot -f json |
| 148 | +## topic |
| 149 | + |
| 150 | +View posts within a topic (first page). |
| 151 | + |
| 152 | +```bash |
| 153 | +opencli linux-do topic 1234 |
| 154 | +opencli linux-do topic 1234 --limit 50 |
| 155 | +opencli linux-do topic 1234 --main_only -f json | jq -r '.[0].content' |
| 156 | +``` |
| 157 | + |
| 158 | +Notes: |
| 159 | +- `--main_only` returns only the main post row and keeps the body untruncated |
| 160 | + |
| 161 | +Output columns: `author`, `content`, `likes`, `created_at` |
| 162 | + |
| 163 | +## user-topics |
| 164 | + |
| 165 | +List topics created by a user. |
| 166 | + |
| 167 | +```bash |
| 168 | +opencli linux-do user-topics neo |
| 169 | +opencli linux-do user-topics neo --limit 10 |
| 170 | +``` |
| 171 | + |
| 172 | +Output columns: `rank`, `title`, `replies`, `created_at`, `likes`, `views`, `url` |
| 173 | + |
| 174 | +## user-posts |
| 175 | + |
| 176 | +List replies posted by a user. |
| 177 | + |
| 178 | +```bash |
| 179 | +opencli linux-do user-posts neo |
| 180 | +opencli linux-do user-posts neo --limit 10 |
| 181 | +``` |
| 182 | + |
| 183 | +Output columns: `index`, `topic_user`, `topic`, `reply`, `time`, `url` |
| 184 | + |
| 185 | +## Compatibility |
| 186 | + |
| 187 | +The legacy commands below are still available as compatibility wrappers while `feed` becomes the canonical entrypoint: |
| 188 | + |
| 189 | +```bash |
| 190 | +opencli linux-do latest |
| 191 | +opencli linux-do hot --period weekly |
| 192 | +opencli linux-do category develop 4 |
| 193 | +``` |
| 194 | + |
| 195 | +Preferred modern forms: |
| 196 | + |
| 197 | +```bash |
| 198 | +opencli linux-do feed --view latest |
| 199 | +opencli linux-do feed --view top --period weekly |
| 200 | +opencli linux-do feed --category 4 |
40 | 201 | ``` |
41 | 202 |
|
42 | 203 | ## Prerequisites |
|
0 commit comments