fix: P0 Windows Edge path, add time localization, show --output, cleanup tech debt

- Fix auth.py subprocess script Windows Edge cookie path inconsistency
- Add timeutil.py for UTC→local time and relative time conversion
- Integrate time localization into formatter.py and serialization.py
- Add --output/-o option to show command for saving tweet detail as JSON
- Remove constants.py legacy aliases (USER_AGENT, SEC_CH_UA)
- Remove client.py backward-compat delegation methods and re-exports
- Update test imports to use parser module directly
This commit is contained in:
jackwener
2026-03-14 13:26:36 +08:00
parent 80e5a62890
commit ec4589c2d1
9 changed files with 128 additions and 63 deletions

View File

@@ -737,10 +737,11 @@ def _print_show_hint():
@click.argument("index", type=click.IntRange(1))
@click.option("--max", "-n", "max_count", type=int, default=None, help="Max replies to fetch.")
@click.option("--full-text", is_flag=True, help="Show full reply text in table output.")
@click.option("--output", "-o", "output_file", type=str, default=None, help="Save tweet detail as JSON to file.")
@structured_output_options
@click.pass_context
def show(ctx, index, max_count, full_text, as_json, as_yaml):
# type: (Any, int, Optional[int], bool, bool, bool) -> None
def show(ctx, index, max_count, full_text, output_file, as_json, as_yaml):
# type: (Any, int, Optional[int], bool, Optional[str], bool, bool) -> None
"""View tweet #INDEX from the last feed/search results."""
compact = ctx.obj.get("compact", False)
@@ -769,6 +770,11 @@ def show(ctx, index, max_count, full_text, as_json, as_yaml):
except RuntimeError as exc:
_exit_with_error(exc)
if output_file:
Path(output_file).write_text(tweets_to_json(tweets), encoding="utf-8")
if rich_output:
console.print("💾 Saved to %s\n" % output_file)
_emit_tweet_detail(tweets, compact=compact, as_json=as_json, as_yaml=as_yaml, full_text=full_text)