File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
crates/chat-cli/src/cli/chat/cli Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ pub enum TodoSubcommand {
2929
3030 /// Delete a to-do list
3131 Delete ,
32+
33+ /// Display current to-do list
34+ Show
3235}
3336
3437/// Used for displaying completed and in-progress todo lists
@@ -170,6 +173,26 @@ impl TodoSubcommand {
170173 } ,
171174 Err ( _) => return Err ( ChatError :: Custom ( "Could not show to-do lists" . into ( ) ) ) ,
172175 } ,
176+ Self :: Show => {
177+ if let Some ( id) = TodoState :: get_current_todo_id ( os) . unwrap_or ( None ) {
178+ let state = match TodoState :: load ( os, & id) {
179+ Ok ( s) => s,
180+ Err ( _) => {
181+ return Err ( ChatError :: Custom ( "Could not load current to-do list" . into ( ) ) ) ;
182+ } ,
183+ } ;
184+ match state. display_list ( & mut session. stderr ) {
185+ Ok ( _) => execute ! ( session. stderr, style:: Print ( "\n " ) ) ?,
186+ Err ( _) => {
187+ return Err ( ChatError :: Custom ( "Could not display current to-do list" . into ( ) ) ) ;
188+ } ,
189+ } ;
190+ } else {
191+ execute ! ( session. stderr, style:: Print ( "No to-do list currently loaded\n " ) ) ?;
192+ }
193+
194+ }
195+
173196 }
174197 Ok ( ChatState :: PromptUser {
175198 skip_printing_tools : true ,
You can’t perform that action at this time.
0 commit comments