fix: console output to stderr for clean --json output
- Change Console() to Console(stderr=True) so all status/progress messages go to stderr, keeping stdout pure JSON when --json is used - Add missing exception handling in likes command for fetch_user - Fix SKILL.md: favorite -> favorites (correct command name)
This commit is contained in:
4
SKILL.md
4
SKILL.md
@@ -32,7 +32,7 @@ twitter feed
|
||||
twitter feed -t following
|
||||
|
||||
# Bookmarks
|
||||
twitter favorite
|
||||
twitter favorites
|
||||
|
||||
# User profile and posts
|
||||
twitter user <screen_name>
|
||||
@@ -55,7 +55,7 @@ Filtering is opt-in (disabled by default). Enable with `--filter`.
|
||||
|
||||
```bash
|
||||
twitter feed --filter
|
||||
twitter favorite --filter
|
||||
twitter favorites --filter
|
||||
```
|
||||
|
||||
The scoring formula:
|
||||
|
||||
@@ -46,7 +46,7 @@ from .formatter import (
|
||||
from .serialization import tweets_from_json, tweets_to_json, users_to_json
|
||||
|
||||
|
||||
console = Console()
|
||||
console = Console(stderr=True)
|
||||
FEED_TYPES = ["for-you", "following"]
|
||||
|
||||
|
||||
@@ -296,7 +296,11 @@ def likes(screen_name, max_count, as_json, do_filter):
|
||||
config = load_config()
|
||||
client = _get_client(config)
|
||||
console.print("👤 Fetching @%s's profile..." % screen_name)
|
||||
try:
|
||||
profile = client.fetch_user(screen_name)
|
||||
except RuntimeError as exc:
|
||||
console.print("[red]❌ %s[/red]" % exc)
|
||||
sys.exit(1)
|
||||
_fetch_and_display(
|
||||
lambda count: client.fetch_user_likes(profile.id, count),
|
||||
"@%s likes" % screen_name, "❤️", max_count, as_json, None, do_filter, config,
|
||||
|
||||
Reference in New Issue
Block a user