refactor: rename --latest to --following for clarity
Matches Twitter's UI terminology ("For You" vs "Following" tabs),
making the flag immediately understandable to users.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
committed by
Peter Steinberger
co-authored by
Claude Opus 4.5
parent
5bb9e48252
commit
92742cac38
@@ -7,10 +7,10 @@ export function registerHomeCommand(program: Command, ctx: CliContext): void {
|
|||||||
.command('home')
|
.command('home')
|
||||||
.description('Get your home timeline ("For You" feed)')
|
.description('Get your home timeline ("For You" feed)')
|
||||||
.option('-n, --count <number>', 'Number of tweets to fetch', '20')
|
.option('-n, --count <number>', 'Number of tweets to fetch', '20')
|
||||||
.option('--latest', 'Get "Following" (chronological) instead of "For You"')
|
.option('--following', 'Get "Following" feed (chronological) instead of "For You"')
|
||||||
.option('--json', 'Output as JSON')
|
.option('--json', 'Output as JSON')
|
||||||
.option('--json-full', 'Output as JSON with full raw API response in _raw field')
|
.option('--json-full', 'Output as JSON with full raw API response in _raw field')
|
||||||
.action(async (cmdOpts: { count?: string; latest?: boolean; json?: boolean; jsonFull?: boolean }) => {
|
.action(async (cmdOpts: { count?: string; following?: boolean; json?: boolean; jsonFull?: boolean }) => {
|
||||||
const opts = program.opts();
|
const opts = program.opts();
|
||||||
const timeoutMs = ctx.resolveTimeoutFromOptions(opts);
|
const timeoutMs = ctx.resolveTimeoutFromOptions(opts);
|
||||||
const count = Number.parseInt(cmdOpts.count || '20', 10);
|
const count = Number.parseInt(cmdOpts.count || '20', 10);
|
||||||
@@ -34,12 +34,12 @@ export function registerHomeCommand(program: Command, ctx: CliContext): void {
|
|||||||
const client = new TwitterClient({ cookies, timeoutMs });
|
const client = new TwitterClient({ cookies, timeoutMs });
|
||||||
const includeRaw = cmdOpts.jsonFull ?? false;
|
const includeRaw = cmdOpts.jsonFull ?? false;
|
||||||
|
|
||||||
const result = cmdOpts.latest
|
const result = cmdOpts.following
|
||||||
? await client.getHomeLatestTimeline(count, { includeRaw })
|
? await client.getHomeLatestTimeline(count, { includeRaw })
|
||||||
: await client.getHomeTimeline(count, { includeRaw });
|
: await client.getHomeTimeline(count, { includeRaw });
|
||||||
|
|
||||||
if (result.success && result.tweets) {
|
if (result.success && result.tweets) {
|
||||||
const feedType = cmdOpts.latest ? 'Following' : 'For You';
|
const feedType = cmdOpts.following ? 'Following' : 'For You';
|
||||||
const emptyMessage = `No tweets found in ${feedType} timeline.`;
|
const emptyMessage = `No tweets found in ${feedType} timeline.`;
|
||||||
const isJson = cmdOpts.json || cmdOpts.jsonFull;
|
const isJson = cmdOpts.json || cmdOpts.jsonFull;
|
||||||
ctx.printTweets(result.tweets, { json: isJson, emptyMessage });
|
ctx.printTweets(result.tweets, { json: isJson, emptyMessage });
|
||||||
|
|||||||
Reference in New Issue
Block a user