From 907fb3b8ec5128ae9931f7e77c305e59fae79187 Mon Sep 17 00:00:00 2001 From: Aaron Cook Date: Sat, 11 Jun 2022 12:46:23 -0500 Subject: [PATCH] Update readme and help prints --- README.md | 40 +++++++++++++++++++++++++++++++++++----- src/bytenuts.c | 3 ++- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b1893d7..cebd00d 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Bytenuts has been tested and built on x86-64 and 32-bit ARM Ubuntu 18. - Output history - Use page up/down, home/end, and ctrl + up/down arrow to scroll through the output window - Output logging - Output can be saved to a log file passed in with the `-l` option - Quick commands - Pages of quick commands are loaded from `~/.config/bytenuts/commands[1-10]` +- Session resumption - Bytenuts can load the previous instance's commands and serial output ## Planned Features @@ -50,12 +51,35 @@ bytenuts [OPTIONS] Configs get loaded from ${HOME}/.bytenuts/config (if file exists) -OPTIONS + OPTIONS +========= --h: show this help --b : set a baud rate (default 115200) --l : log all output to the given file --c : load a config from the given path rather than the default +-h + Show this help. + +-b + Set a baud rate (default 115200). + +-l + Log all output to the given file. + +-c + Load a config from the given path rather than the default. + +-r|--resume + Resume the previous instance of bytenuts. + +--colors=<0|1> + Turn 8-bit ANSI colors off/on. + +--echo=<0|1> + Turn input echoing off/on. + +--no_crlf=<0|1> + Choose to send LF and not CRLF on input. + +--escape= + Change the default ctrl+b escape character. ``` ## Navigation @@ -76,11 +100,13 @@ There are only three supported configs currently. Each config is defined like `< colors=1 echo=0 no_crlf=0 +escape=a ``` - `colors` - enable parsing of 8-bit ANSI color codes - `echo` - echo input to the terminal in app - `no_crlf` - just send a line feed (`\n`) for user input rather than carriage return + line feed (`\r\n`) +- `escape` - change what character is used as an escape sequence for commands (e.g. if set to `escape=a`, Bytenuts can be exited with `ctrl+a, q`) Bytenuts looks for the configs at `~/.config/bytenuts/config`. @@ -116,6 +142,10 @@ Bytenuts will only store the first ten commands for each page, so the first 10 l On startup, command page 1 is selected. You can select which command page is currently loaded by doing `ctrl+p, [0-9]` to load the desired page (note that index 0 will correspond to `commands10`). +## Session Resumption + +Bytenuts caches the current instance's command list and output buffer in `~/.config/bytenuts/inbuf.log` and `~/.config/bytenuts/outbuf.log` respectively. If launched with the `-r` flag, Bytenuts will load in the input and output history from those files. The `outbuf.log` can also serve as a backup log if one forgot to launch with the `-l` flag. + ## Bugs Check out known bugs in the [issues tab](https://github.com/cookthebook/bytenuts/issues?q=is%3Aissue+is%3Aopen+label%3Abug). diff --git a/src/bytenuts.c b/src/bytenuts.c index a77cd6f..54090df 100644 --- a/src/bytenuts.c +++ b/src/bytenuts.c @@ -21,6 +21,7 @@ "-b \n Set a baud rate (default 115200).\n\n" \ "-l \n Log all output to the given file.\n\n" \ "-c \n Load a config from the given path rather than the default.\n\n" \ +"-r|--resume\n Resume the previous instance of bytenuts.\n\n" \ "--colors=<0|1>\n Turn 8-bit ANSI colors off/on.\n\n" \ "--echo=<0|1>\n Turn input echoing off/on.\n\n" \ "--no_crlf=<0|1>\n Choose to send LF and not CRLF on input.\n\n" \ @@ -351,7 +352,7 @@ parse_args(int argc, char **argv) bytenuts.config.escape = argv[i][9]; bytenuts.config_overrides[3] = 1; } - else if (!strcmp(argv[i], "--resume")) { + else if (!strcmp(argv[i], "--resume") || !strcmp(argv[i], "-r")) { bytenuts.resume = 1; } else {