File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,9 +23,13 @@ fn get_clock_emoji(remaining_hours: f64) -> &'static str {
2323 CLOCKS [ idx]
2424}
2525
26- /// Format 5-hour time remaining
27- pub fn format_time_remaining_5h ( block : & Block , api_usage : Option < & ApiUsageData > ) -> Option < String > {
28- if !block. is_active {
26+ /// Format 5-hour time remaining (subscription only)
27+ pub fn format_time_remaining_5h (
28+ block : & Block ,
29+ api_usage : Option < & ApiUsageData > ,
30+ plan_type : PlanType ,
31+ ) -> Option < String > {
32+ if matches ! ( plan_type, PlanType :: Api ) || !block. is_active {
2933 return None ;
3034 }
3135
@@ -43,8 +47,15 @@ pub fn format_time_remaining_5h(block: &Block, api_usage: Option<&ApiUsageData>)
4347 Some ( format_hours_remaining ( remaining_hours) )
4448}
4549
46- /// Format 7-day time remaining
47- pub fn format_time_remaining_7d ( api_usage : Option < & ApiUsageData > ) -> Option < String > {
50+ /// Format 7-day time remaining (subscription only)
51+ pub fn format_time_remaining_7d (
52+ api_usage : Option < & ApiUsageData > ,
53+ plan_type : PlanType ,
54+ ) -> Option < String > {
55+ if matches ! ( plan_type, PlanType :: Api ) {
56+ return None ;
57+ }
58+
4859 let now = Utc :: now ( ) ;
4960
5061 if let Some ( api) = api_usage
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ fn run_interactive_mode() -> Result<()> {
114114
115115 parts. push ( format ! ( "💰{}" , format_block_info( & block) ) ) ;
116116
117- if let Some ( time) = format_time_remaining_5h ( & block, api_usage. as_ref ( ) ) {
117+ if let Some ( time) = format_time_remaining_5h ( & block, api_usage. as_ref ( ) , plan_type ) {
118118 parts. push ( time) ;
119119 }
120120
@@ -201,12 +201,13 @@ fn generate_statusline(hook_data: &HookData) -> Result<String> {
201201 parts. push ( format ! ( "💰{}" , format_block_info( & block) ) ) ;
202202 }
203203 StatusElement :: TimeRemaining5h => {
204- if let Some ( time) = format_time_remaining_5h ( & block, api_usage. as_ref ( ) ) {
204+ if let Some ( time) = format_time_remaining_5h ( & block, api_usage. as_ref ( ) , plan_type)
205+ {
205206 parts. push ( time) ;
206207 }
207208 }
208209 StatusElement :: TimeRemaining7d => {
209- if let Some ( time) = format_time_remaining_7d ( api_usage. as_ref ( ) ) {
210+ if let Some ( time) = format_time_remaining_7d ( api_usage. as_ref ( ) , plan_type ) {
210211 parts. push ( time) ;
211212 }
212213 }
You can’t perform that action at this time.
0 commit comments