From: Tilman Sauerbeck Date: Thu, 9 Jan 2020 22:40:50 +0000 (+0100) Subject: common: Implement the "ls" shell command. X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=cc19114907acfc14874032c8cb520138dd47c31c;p=gps-watch.git common: Implement the "ls" shell command. Shows a listing of the stored recordings. --- diff --git a/src/common/shell.rs b/src/common/shell.rs index 59472f6..097bd0c 100644 --- a/src/common/shell.rs +++ b/src/common/shell.rs @@ -197,6 +197,7 @@ impl<'a> Shell<'a> { let usage = b"\ Supported commands: help Show this help message. + ls List recordings. get REC_ID Retrieve recording. clear_storage Fully erase the flash's contents. dump_storage Dump the flash's contents. @@ -205,6 +206,7 @@ Supported commands: self.tx_buf.write(usage); }, + Some(b"ls") => self.run_ls(logger), Some(b"get") => self.run_get(logger, &mut args_iter), Some(b"clear_storage") => self.run_clear_storage(logger), Some(b"dump_storage") => self.run_dump_storage(logger), @@ -220,6 +222,10 @@ Supported commands: } } + fn run_ls(&mut self, logger: &mut Logger) { + logger.list_recordings(self.tx_buf); + } + fn run_get(&mut self, logger: &mut Logger, args_iter: &mut ArgumentIter) { if let Some(recording_id_s) = args_iter.next() { if let Some(recording_id) = atoi16(recording_id_s) {