@@ -47,7 +47,7 @@ const handler = Effect.fn("cli.session.list")(function* (
4747 null ,
4848 2 ,
4949 )
50- : formatTable ( page . data ) ) + EOL
50+ : formatList ( page . data ) ) + EOL
5151 const write = Effect . tryPromise (
5252 ( ) =>
5353 new Promise < void > ( ( resolve , reject ) => {
@@ -96,18 +96,14 @@ export default Runtime.handler(Commands.commands.session.commands.list, (input)
9696 ) ,
9797)
9898
99- function formatTable ( sessions : ReadonlyArray < SessionInfo > ) {
100- const rows = sessions . map ( ( session ) => ( {
101- id : session . id ,
102- title : ( session . title ?? "Untitled session" ) . replace ( / [ \r \n \t ] / g, " " ) ,
103- updated : new Date ( session . time . updated ) . toLocaleString ( ) ,
104- } ) )
105- const idWidth = Math . max ( 20 , ...rows . map ( ( row ) => row . id . length ) )
106- const titleWidth = Math . max ( 25 , ...rows . map ( ( row ) => row . title . length ) )
107- const header = `${ "Session ID" . padEnd ( idWidth ) } ${ "Title" . padEnd ( titleWidth ) } Updated`
108- return [
109- header ,
110- "─" . repeat ( header . length ) ,
111- ...rows . map ( ( row ) => `${ row . id . padEnd ( idWidth ) } ${ row . title . padEnd ( titleWidth ) } ${ row . updated } ` ) ,
112- ] . join ( EOL )
99+ function formatList ( sessions : ReadonlyArray < SessionInfo > ) {
100+ return sessions
101+ . map ( ( session ) =>
102+ [
103+ session . id ,
104+ ( session . title ?? "Untitled session" ) . replace ( / [ \r \n \t ] / g, " " ) ,
105+ new Date ( session . time . updated ) . toLocaleString ( ) ,
106+ ] . join ( "\t" ) ,
107+ )
108+ . join ( EOL )
113109}
0 commit comments