Simplify apps/cli/ code
- config.ts: Convert arrow functions to function declarations - api-client.ts: Extract duplicated RPCLink logic into buildClient helper - format-error.ts: Add centralized ORPCError handling - complete-login.ts: Remove redundant error handling (now in formatError) - status.ts: Simplify formatRelativeTime, improve whitespace - create.ts: Rename validRoles to VALID_ROLES, add as const, early return - completions.ts: Derive Shell type from SUPPORTED_SHELLS array Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,16 +17,16 @@ function formatRelativeTime(date: Date): string {
|
||||
if (diffDays < 0) {
|
||||
return `${Math.abs(diffDays).toLocaleString()} days ago`;
|
||||
}
|
||||
|
||||
if (diffDays === 0) {
|
||||
const diffHours = Math.floor(diffMs / (1000 * 60 * 60));
|
||||
if (diffHours <= 0) {
|
||||
return "expired";
|
||||
}
|
||||
return `in ${diffHours.toLocaleString()} hours`;
|
||||
return diffHours <= 0 ? "expired" : `in ${diffHours.toLocaleString()} hours`;
|
||||
}
|
||||
|
||||
if (diffDays === 1) {
|
||||
return "tomorrow";
|
||||
}
|
||||
|
||||
return `in ${diffDays.toLocaleString()} days`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user