diff options
author | Shav Kinderlehrer <[email protected]> | 2023-04-19 22:30:10 -0400 |
---|---|---|
committer | Shav Kinderlehrer <[email protected]> | 2023-04-19 22:30:55 -0400 |
commit | 83929dd8aa8f528dcf67f5fa22a7a3a53433ab67 (patch) | |
tree | f4ad81bad6817114e375df71861df0a4f05eb8dc /src/lib/arg.c | |
parent | c713312b2281787030602e6d1e10d5a65cd2dbce (diff) | |
download | lat-83929dd8aa8f528dcf67f5fa22a7a3a53433ab67.tar.gz lat-83929dd8aa8f528dcf67f5fa22a7a3a53433ab67.zip |
Add argsv0.11.0
- --literal
- fix outputting format for less and piped output (finally)
Diffstat (limited to 'src/lib/arg.c')
-rw-r--r-- | src/lib/arg.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/arg.c b/src/lib/arg.c index bef7b49..ce8f910 100644 --- a/src/lib/arg.c +++ b/src/lib/arg.c @@ -5,7 +5,7 @@ #include "arg.h" #include "util.h" -#define LAT_USAGE "usage: lat [-cntbpVh] [file...]" +#define LAT_USAGE "usage: lat [-cntblpVh] [file...]" void help(void) { printf("lat | lazy cat - a cat clone with some quality-of-life " @@ -18,6 +18,7 @@ void help(void) { "\t-t, --headers\t toggle file info headers\n" "\t-b, --binary\t toggle binary mode, -b forces binary and -bb forces " "NOT binary\n" + "\t-l, --literal\t print everything to stdout (or equivalent)\n" "\t-p, --pager\t print file with the pager (uses less)\n" "\t-V, --version\t show program version\n" "\t-h, --help\t display this help text (--help shows additional " @@ -42,7 +43,9 @@ void examples(void) { "\tlat -bb --pager file.txt\n\t\t force file.txt to NOT be treated " "as a binary file and print it in the pager\n" "\tcurl example.com | lat\n\t\t pipe the results of 'curl example.com' " - "into lat\n"); + "into lat\n" + "\tfzf --preview 'lat -l {}'\n\t\t use lat as the file viewer in fzf\n" + ); } void version(void) { @@ -82,6 +85,10 @@ void parselongarg(char *arg) { return; } + if (strcmp(arg, "--literal") == 0) { + conf.literal = !conf.literal; + } + if (strcmp(arg, "--pager") == 0) { conf.pager = !conf.pager; } @@ -122,6 +129,9 @@ void parseshortarg(char *arg) { else conf.force_binary = !conf.force_binary; break; + case 'l': + conf.literal = !conf.literal; + break; case 'p': conf.pager = !conf.pager; break; |