File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ use std::fmt::Display;
33use std:: fs:: File ;
44use std:: process:: Command as ProcessCommand ;
55
6- use chrono_humanize:: HumanTime ;
76use clap:: { Parser , Subcommand } ;
87
98use crate :: common:: NonEmptyString ;
@@ -303,12 +302,7 @@ impl<T: FrameStore> CommandExecutor<T> {
303302 match self . frame_store . get_ongoing_frame ( ) {
304303 None => Err ( CliError :: NoOngoingRecording ) ,
305304 Some ( frame) => {
306- println ! (
307- "Project {} started {}, ({})" ,
308- frame. project( ) ,
309- HumanTime :: from( * frame. start( ) ) ,
310- frame. start( )
311- ) ;
305+ println ! ( "{}" , frame) ;
312306 Ok ( ( ) )
313307 }
314308 }
Original file line number Diff line number Diff line change 1- use std:: hash:: { DefaultHasher , Hasher } ;
1+ use std:: {
2+ fmt:: Display ,
3+ hash:: { DefaultHasher , Hasher } ,
4+ } ;
25
36use chrono:: { DateTime , Local , TimeZone } ;
7+ use chrono_humanize:: HumanTime ;
48
59use crate :: {
610 common:: NonEmptyString ,
@@ -107,6 +111,18 @@ impl Frame {
107111 }
108112}
109113
114+ impl Display for Frame {
115+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
116+ write ! (
117+ f,
118+ "Project {} started {} ({})" ,
119+ self . project,
120+ HumanTime :: from( self . start) ,
121+ self . start
122+ )
123+ }
124+ }
125+
110126/// Represents a completed frame.
111127/// A completed frame is guaranteed to have an end time.
112128#[ derive( Debug , Clone ) ]
You can’t perform that action at this time.
0 commit comments