From 15d033a93c709b431ac44531a82df359126f1305 Mon Sep 17 00:00:00 2001 From: Brian Barto Date: Thu, 12 Jan 2017 16:38:24 -0500 Subject: [PATCH] Add clear-screen functionality modified: README.md modified: src/main.c --- README.md | 8 ++++++++ src/main.c | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a01c521..93caf33 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ for the user to press a key before it starts the decryption sequence. ls -l / | nms ls -l / | nms -a // Set auto-decrypt flag ls -l / | nms -f green // Set foreground color to green +ls -l / | nms -c // Clear screen ``` #### Command Line Options @@ -100,6 +101,13 @@ This option sets the foreground color of the decrypted text to the color specified. Valid options are white, yellow, black, magenta, blue, green, or red. This is blue by default. +`-c` + +This option clears the screen prior to printing any output. Specifically, +it saves the state of the terminal (all current output), and restores it +once the effect is comlpeted. Note that when using this option, `nms` requires +the user to press a key before restoring the terminal. + License ------- diff --git a/src/main.c b/src/main.c index 6de65e3..0c29104 100644 --- a/src/main.c +++ b/src/main.c @@ -12,7 +12,7 @@ int main(int argc, char *argv[]) { char *input = NULL; // Processing command arguments - while ((o = getopt(argc, argv, "f:av")) != -1) { + while ((o = getopt(argc, argv, "f:acv")) != -1) { switch (o) { case 'f': nms_set_foreground_color(optarg); @@ -20,6 +20,9 @@ int main(int argc, char *argv[]) { case 'a': nms_set_auto_decrypt(1); break; + case 'c': + nms_set_clear_scr(1); + break; case 'v': printf("nms version " VERSION "\n"); return 0;