Add clear-screen functionality

modified:   README.md
	modified:   src/main.c
This commit is contained in:
Brian Barto 2017-01-12 16:38:24 -05:00
parent 597e61d33a
commit 15d033a93c
2 changed files with 12 additions and 1 deletions

View File

@ -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
-------

View File

@ -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;