From e52b86b69b9dc6a7b7ec9d578c20d88fc1ccb330 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 18 Oct 2021 14:48:29 -0400 Subject: Add shotty -t to animate (crudely) between snapshots --- bin/man1/shotty.1 | 7 +++++++ bin/shotty.l | 25 ++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/bin/man1/shotty.1 b/bin/man1/shotty.1 index 0a3bd127..18cf52f6 100644 --- a/bin/man1/shotty.1 +++ b/bin/man1/shotty.1 @@ -12,6 +12,7 @@ .Op Fl b Ar bg .Op Fl f Ar fg .Op Fl h Ar rows +.Op Fl t Ar ms .Op Fl w Ar cols .Op Ar file . @@ -82,6 +83,12 @@ Hide the cursor. Copy the terminal size from the current terminal. . +.It Fl t Ar ms +Animate between snapshots +at an interval of +.Ar ms +milliseconds. +. .It Fl w Ar cols Set the terminal width. The default is 80. diff --git a/bin/shotty.l b/bin/shotty.l index 070022a2..1655a09a 100644 --- a/bin/shotty.l +++ b/bin/shotty.l @@ -507,8 +507,9 @@ int main(int argc, char *argv[]) { bool debug = false; bool size = false; bool hide = false; + int interval = 0; - for (int opt; 0 < (opt = getopt(argc, argv, "Bb:df:h:insw:"));) { + for (int opt; 0 < (opt = getopt(argc, argv, "Bb:df:h:inst:w:"));) { switch (opt) { break; case 'B': bright = true; break; case 'b': defaultBg = atoi(optarg); @@ -518,6 +519,7 @@ int main(int argc, char *argv[]) { break; case 'i': colors = true; break; case 'n': hide = true; break; case 's': size = true; + break; case 't': interval = atoi(optarg); break; case 'w': cols = atoi(optarg); break; default: return EX_USAGE; } @@ -559,4 +561,25 @@ int main(int argc, char *argv[]) { } if (hide) mode &= ~Cursor; if (!mc) html(); + + if (interval) { + printf( + Q( + + ), + interval + ); + } } -- cgit 1.4.1