refactor: rename bookmark commands to favorite/unfavorite/favorites

- favorite <id>     → bookmark a tweet (was bookmark-add)
- unfavorite <id>    → remove bookmark (was bookmark-rm)
- favorites          → list all bookmarks (was favorite)

Consistent with like/unlike/likes naming pattern.
This commit is contained in:
jackwener
2026-03-08 14:00:38 +08:00
parent d2d971c865
commit 215337ebec
2 changed files with 18 additions and 18 deletions

View File

@@ -32,7 +32,7 @@ A terminal-first CLI for Twitter/X: read timelines, bookmarks, and user profiles
- Delete: remove your own tweets
- Like / Unlike: manage tweet likes
- Retweet / Unretweet: manage retweets
- Bookmark: add/remove bookmarks
- Bookmark: favorite/unfavorite
**Auth:**
- Cookie auth: use browser cookies or environment variables
@@ -77,8 +77,8 @@ twitter feed --json > tweets.json
twitter feed --input tweets.json
# Bookmarks
twitter favorite
twitter favorite --max 30 --json
twitter favorites
twitter favorites --max 30 --json
# Search
twitter search "Claude Code"
@@ -107,8 +107,8 @@ twitter like 1234567890
twitter unlike 1234567890
twitter rt 1234567890
twitter unrt 1234567890
twitter bookmark-add 1234567890
twitter bookmark-rm 1234567890
twitter favorite 1234567890
twitter unfavorite 1234567890
```
### Authentication
@@ -256,7 +256,7 @@ After installation, OpenClaw can call `twitter-cli` commands directly.
- 删除:删除自己的推文
- 点赞 / 取消点赞
- 转推 / 取消转推
- 书签管理:添加/移除书签
- 收藏 / 取消收藏favorite/unfavorite
- 可选筛选:按 engagement score 排序
- Cookie 认证:支持环境变量和浏览器自动提取
@@ -277,7 +277,7 @@ twitter feed -t following
twitter feed --filter
# 收藏
twitter favorite
twitter favorites
# 搜索
twitter search "Claude Code"
@@ -304,8 +304,8 @@ twitter like 1234567890
twitter unlike 1234567890
twitter rt 1234567890
twitter unrt 1234567890
twitter bookmark-add 1234567890
twitter bookmark-rm 1234567890
twitter favorite 1234567890
twitter unfavorite 1234567890
```
### 认证说明

View File

@@ -3,7 +3,7 @@
Read commands:
twitter feed # home timeline (For You)
twitter feed -t following # following feed
twitter favorite # bookmarks
twitter favorites # bookmarks
twitter search "query" # search tweets
twitter user elonmusk # user profile
twitter user-posts elonmusk # user tweets
@@ -17,8 +17,8 @@ Write commands:
twitter post "text" # post a tweet
twitter delete <id> # delete a tweet
twitter like/unlike <id> # like/unlike
twitter favorite/unfavorite <id> # bookmark/unbookmark
twitter rt/unrt <id> # retweet/unretweet
twitter bookmark-add/rm <id> # bookmark management
"""
from __future__ import annotations
@@ -205,7 +205,7 @@ def feed(feed_type, max_count, as_json, input_file, output_file, do_filter):
@click.option("--json", "as_json", is_flag=True, help="Output as JSON.")
@click.option("--output", "-o", "output_file", type=str, default=None, help="Save tweets to JSON file.")
@click.option("--filter", "do_filter", is_flag=True, help="Enable score-based filtering.")
def favorite(max_count, as_json, output_file, do_filter):
def favorites(max_count, as_json, output_file, do_filter):
# type: (Optional[int], bool, Optional[str], bool) -> None
"""Fetch bookmarked (favorite) tweets."""
config = load_config()
@@ -488,19 +488,19 @@ def unrt(tweet_id):
_write_action("🔄", "Undoing retweet", "unretweet", tweet_id)
@cli.command(name="bookmark-add")
@cli.command()
@click.argument("tweet_id")
def bookmark_add(tweet_id):
def favorite(tweet_id):
# type: (str,) -> None
"""Bookmark a tweet. TWEET_ID is the numeric tweet ID."""
"""Bookmark (favorite) a tweet. TWEET_ID is the numeric tweet ID."""
_write_action("🔖", "Bookmarking tweet", "bookmark_tweet", tweet_id)
@cli.command(name="bookmark-rm")
@cli.command()
@click.argument("tweet_id")
def bookmark_rm(tweet_id):
def unfavorite(tweet_id):
# type: (str,) -> None
"""Remove a tweet from bookmarks. TWEET_ID is the numeric tweet ID."""
"""Remove a tweet from bookmarks (unfavorite). TWEET_ID is the numeric tweet ID."""
_write_action("🔖", "Removing bookmark", "unbookmark_tweet", tweet_id)